/**Main gui of eHOST*/
package UserInterface;

import verification.Verification2011;
import Relationship.Importing.WrapperForBoth;
import Relationship.Complex.Creation.ComplexSchemaManager;
import ResultEditor.Annotations.Depot;
import ResultEditor.Annotations.Annotation;
import ResultEditor.Annotations.Article;
import ResultEditor.Conflicts.classConflict;
import ResultEditor.Annotations.ComplexRelationship;
import ResultEditor.Annotations.eComplex;
import ResultEditor.Annotations.suggestion;
import ResultEditor.ComplexRelationship.iListable;
import ResultEditor.Conflicts.tmp_Conflicts;
import ResultEditor.Conflicts.spanOverlaps;
import WorkSpace.Switcher.RecentWorkSpace;
import java.awt.event.MouseEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.*;
import java.awt.*;
import ResultEditor.WorkSpace.WorkSet;
import Relationship.Simple.DataTypes.Attribute;
import Relationship.Complex.DataTypes.ComplexRelImportReturn;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.Collections;
import java.util.HashSet;
import java.util.TreeSet;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.io.FileNotFoundException;
import sync.AssignmentsScreen;
import verification.VerifyChallenge2011;


/**
 * main GUI of eHOST<p>
 *
 * @author  Jianwei Leng (Chris)
 * @since   Feb 9, 2010, 2:34:52 PM
 * @since   JDK1.5
 */

public class GUI extends javax.swing.JFrame
{
    //<editor-fold defaultstate="collapsed" desc="Member Variables">
    protected enum fileInputType{
        importXMLandPin, selectClinicalTextFiles, setXmlOutputforConcepts
    };
    private ComplexRelationship addingTo = null;
    // this path depend on operation system type, and it will be set to correct
    // value in output package
    private ResultEditor.ComplexRelationship.Editor editor = null;
    private ResultEditor.SimpleSchema.Editor simpleEditor = null;
    private ComplexSchemaManager complexEditor = null;
    private ResultEditor.AnnotationBuilder.Popmenu popmenu = null;
    private HotKeys hotkeyDialog = null;
    private String xmloutput_path = ".\\xmloutput";
    private boolean FLAG_MAYBE_CHANGED = true;
    private ResultEditor.AnnotationClasses.Manager classmanager = null;
    
    // If a computation is currently taking place
    private boolean computing = false;
    // private String Color = Red|Yellow;
    // out put founder to screen?
    static boolean sentToScreen = false;
    private static boolean Flag_Want_Shutdown_Program = false;
    //private boolean Flag_Displaying_Verifier = false;
    //private ArrayList<Verifier.potentialProblem> verifierIndices = null;

    
    

    /**latest accessed folder in eHOST.*/
    private File recentlyOpennedFolder;

    /**standard border of text field*/
    protected javax.swing.border.Border standardTextfieldBoard;
    final protected boolean RELEASE = true;

    protected ResultEditor.PositionIndicator.JPositionIndicator jpositionIndicator;
    private enum infoScreens {
        CLASSCONFLICT,
        SPANCONFLICT,
        ANNOTATIONS,
        CLASSES,
        ANNOTATORS,
        VERIFIER,
        NONE
    }
    private infoScreens currentScreen = infoScreens.NONE;
    private HashSet<String> classesList = new HashSet<String>();
    private HashSet<String> annotatorsList = new HashSet<String>();
    private Vector<Annotation> annotationsList = new Vector<Annotation>();
    private Vector<classConflict> conflictWithWorking = new Vector<classConflict>();
    private Vector<spanOverlaps> overlappingAnnotations = new Vector<spanOverlaps>();
    private Vector<Annotation> verifierAnnotations = new Vector<Annotation>();
    private String annotationsText = "Number of Annotations: ";
    private String annotatorsText = "Number of Annotators: ";
    private String classesText = "Number of Markables: ";
    private String conflictsText = "Annotations in Conflict with Working Set: ";
    private String overlappingText = "Overlapping Annotations: ";
    private String verifierText = "Annotations Flagged by Verifier: ";

    /**This is the jPanel contains components and functions of the NLP assistatnt*/
    private annotate.gui.NLPAnnotator NLPAnnotationPanel = null;
    /**This is the jPanel contains components and functions of the NLP assistatnt,
     * it's the gui that show the process of NLP
     */
    private annotate.gui.NLPcpu nlpcpu = null;

    /**icons*/
    private static Icon icon_oracle_disabled, icon_oracle_enabled,
                   icon_graphicpath_disabled, icon_graphicpath_enabled,
                   icon_difference_disabled, icon_difference_enabled;

    ///**set it to true while you just pop*/
    //private boolean newSubDialogJustPoped = false;
    /**font size of current document*/
    protected int currentFontSize = 14;


    KeyStroke kc_c= KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK);;
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Constructor">
    /** Creates new form GUIgate */
    public GUI()
    {
        /*
        try{
            javax.swing.UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName() );
        }catch(Exception ee){}*/
        loadRes();

        // #### init components
        initComponents();
        enableFunctionsByMask();
        

        updateComplex();
        //TODOTODO:: move to related model
        /*
        for(ComplexRel rel: env.Parameters.ComplexRelationshipNames) {
            //String s = rel.getName();
            this.jComboBox1.addItem(rel);
        }
         *
         */

        //this.jRadioButton_nlp_normal.setVisible(false);
        //this.jRadioButton_nlp_quick.setVisible(false);
        
        // add file drop event for text source list
        dropEventOfTextSourceList();

        setHandCursor();
        
        setNAVCurrentTab(1);
        
        // reload panels into the cardlayout
        resetCardLayout();
        //jPanelDesktop.removeAll();
        jLabel_infobar.setText("Welcome to eHOST!");
        // set the width of first column of the table

        /* hide the table head of file list
         jTable_SelectedClinicalFiles.getColumnModel().getColumn(0).setPreferredWidth(230);
        DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
        renderer.setPreferredSize(new Dimension(0, 0));
        jTable_SelectedClinicalFiles.getTableHeader().setDefaultRenderer(renderer);
         * */


        // copy files info used in pervious operation from configuration info
        //MUSTMUST load_pervious_input_clinical_notes_from_ini();
        // show the files used in pervious operation in table
        //&&&&2272727 cleanAndReload_ListOfFileCollection();

        

        // show latest mention id number on GUI
        show_latest_mention_id();
        
        
        // **** end of setting the location of gui window

        // #### designate position on screen to this dialog
        setDialogPosition();
              
        // #### enter tab of result Editor as default start page
        tabDoorman( TabGuard.tabs.resulteditor );

        //((ResultEditor.CustomComponents.ExpandablePanel)NavigationPanel).defaultstatus();
        ((ResultEditor.CustomComponents.ExpandablePanel_editor)NavigationPanel_editor).defaultstatus();



        

        standardTextfieldBoard = jTextField_sample.getBorder();

        // subsequence processes after all components got initilized
        componentPostProcessing();

        updateScreen_for_variables();

        // #### check and force to ask user to set workspace setting while necessary
        this.jCardcontainer_interactive.setVisible(false);
        setWorkSpace();
        
    }
    //</editor-fold>

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup_MainButton_startAnalysis = new javax.swing.ButtonGroup();
        jFileChooser1 = new javax.swing.JFileChooser();
        confirmExit = new javax.swing.JDialog();
        jPanel13 = new javax.swing.JPanel();
        jPanel14 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jPanel15 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jPanel16 = new javax.swing.JPanel();
        jPanel22 = new javax.swing.JPanel();
        jButton7 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        buttonGroup_Tabs = new javax.swing.ButtonGroup();
        jTextField_sample = new javax.swing.JTextField();
        buttonGroup_treeview = new javax.swing.ButtonGroup();
        jLabel_icon_annotationlist = new javax.swing.JLabel();
        buttonGroup_quicknlp = new javax.swing.ButtonGroup();
        ToolBar = new javax.swing.JToolBar();
        jToggleButton_ResultEditor = new javax.swing.JToggleButton();
        jToggleButton_CreateAnnotaion = new javax.swing.JToggleButton();
        jToggleButton_PinExtractor = new javax.swing.JToggleButton();
        jToggleButton_DictionaryManager = new javax.swing.JToggleButton();
        jToggleButton_Converter = new javax.swing.JToggleButton();
        jToggleButton_DictionaryManager1 = new javax.swing.JToggleButton();
        jToggleButton_DictionarySetting = new javax.swing.JToggleButton();
        jToggleButton_exit = new javax.swing.JToggleButton();
        BottomInfoBar = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jPanel_infobar_right_current_annotator = new javax.swing.JPanel();
        jLabel_info_annotator = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel_info_annotatorlabel = new javax.swing.JLabel();
        jPanel_infobar_center = new javax.swing.JPanel();
        jLabel_infobar = new javax.swing.JLabel();
        jPanel58 = new javax.swing.JPanel();
        jLabel_infobar_FlagOfOracle = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel_infobar_FlagOfPath = new javax.swing.JLabel();
        jLabel_infobar_FlagOfDiff = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        GUIContainer = new javax.swing.JPanel();
        Editor = new javax.swing.JPanel();
        NavigationPanel1 = new NavigatorContainer.TabPanel(this);
        jPanel_NAV_CardContainer = new javax.swing.JPanel();
        jPanel_NAV_Card1 = new javax.swing.JPanel();
        jPanel8_topBar = new javax.swing.JPanel();
        jLabel31 = new javax.swing.JLabel();
        jPanel8_bottomBar = new javax.swing.JPanel();
        jButton_AddClinicalTexts1 = new javax.swing.JButton();
        jButton26 = new javax.swing.JButton();
        jPanel88 = new javax.swing.JPanel();
        jPanel8_currentWorkSpace = new javax.swing.JPanel();
        jLabel18 = new javax.swing.JLabel();
        jPanel95 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jComboBox_currentworkspace_abspath = new javax.swing.JComboBox();
        jPanel17 = new javax.swing.JPanel();
        jButton5 = new javax.swing.JButton();
        jPanel47 = new javax.swing.JPanel();
        jScrollPane11 = new javax.swing.JScrollPane();
        jList_NAV_projects = new javax.swing.JList();
        jPanel91 = new javax.swing.JPanel();
        jSeparator3 = new javax.swing.JSeparator();
        jLabel20 = new javax.swing.JLabel();
        jPanel_NAV_Card2 = new javax.swing.JPanel();
        jPanel8_topBar1 = new javax.swing.JPanel();
        jLabel32 = new javax.swing.JLabel();
        jPanel8_bottomBar1 = new javax.swing.JPanel();
        jButton_AddClinicalTexts = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jPanel_corpuslist_outline = new javax.swing.JPanel();
        jPanel_corpuslist_innerline = new javax.swing.JPanel();
        jPanel99 = new javax.swing.JPanel();
        jLabel21 = new javax.swing.JLabel();
        jScrollPane12 = new javax.swing.JScrollPane();
        jList_corpus = new javax.swing.JList();
        jPanel_NAV_Card3 = new javax.swing.JPanel();
        jScrollPane_classtree = new javax.swing.JScrollPane();
        jTree_class = new javax.swing.JTree();
        jPanel_colorfulTextBar_filebrowser6 = new javax.swing.JPanel();
        jLabel28 = new javax.swing.JLabel();
        jToolBar5 = new javax.swing.JToolBar();
        jLabel44 = new javax.swing.JLabel();
        jButton23 = new javax.swing.JButton();
        jLabel45 = new javax.swing.JLabel();
        jButton15 = new javax.swing.JButton();
        jButton16 = new javax.swing.JButton();
        jPanel57 = new javax.swing.JPanel();
        jRadioButton_treeview_currentarticle = new javax.swing.JRadioButton();
        jRadioButton_treeview_overall = new javax.swing.JRadioButton();
        jCardcontainer_interactive = new javax.swing.JPanel();
        jSplitPane_between_viewer_and_allatttibutes = new javax.swing.JSplitPane();
        jPanel_interactive_left = new javax.swing.JPanel();
        jPanel73 = new javax.swing.JPanel();
        NavigationPanel_editor = new ResultEditor.CustomComponents.ExpandablePanel_editor(jSplitPane_between_viewer_and_allatttibutes, GUIContainer);
        jPanel12 = new javax.swing.JPanel();
        jPanel37 = new javax.swing.JPanel();
        jPanel_colorfulTextBar_filebrowser2 = new javax.swing.JPanel();
        jLabel25 = new javax.swing.JLabel();
        jPanel8 = new javax.swing.JPanel();
        jToolBar3 = new javax.swing.JToolBar();
        jComboBox_InputFileList = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jButton13 = new javax.swing.JButton();
        jButton14 = new javax.swing.JButton();
        jButton21 = new javax.swing.JButton();
        jButton22 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jButton18 = new javax.swing.JButton();
        jButton19 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jButton_removeduplicates = new javax.swing.JButton();
        jButton_save = new javax.swing.JButton();
        jButton20 = new javax.swing.JButton();
        jButton_save1 = new javax.swing.JButton();
        jTabbedPane3 = new javax.swing.JTabbedPane();
        jPanel36 = new javax.swing.JPanel();
        jPanel43 = new javax.swing.JPanel();
        jLabel_cursor = new javax.swing.JLabel();
        jPanel38 = new javax.swing.JPanel();
        jTextField_searchtext = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jPanel46 = new javax.swing.JPanel();
        jScrollPane_textpane = new javax.swing.JScrollPane();
        textPaneforClinicalNotes = new UserInterface.TxtScreen.TextScreen();
        jPanel_position_indicator_container = new javax.swing.JPanel();
        jPanel77 = new javax.swing.JPanel();
        jPanel78 = new javax.swing.JPanel();
        jPanel79 = new javax.swing.JPanel();
        jPanel80 = new javax.swing.JPanel();
        jPanel82 = new javax.swing.JPanel();
        jLabel26 = new javax.swing.JLabel();
        classes = new javax.swing.JLabel();
        annotations = new javax.swing.JLabel();
        annotators = new javax.swing.JLabel();
        overlapping = new javax.swing.JLabel();
        workingConflicts = new javax.swing.JLabel();
        jPanel86 = new javax.swing.JPanel();
        jPanel92 = new javax.swing.JPanel();
        verifierFlagged = new javax.swing.JLabel();
        jPanel90 = new javax.swing.JPanel();
        verifierOnCurrent = new javax.swing.JButton();
        verifierOnAll = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jButton8 = new javax.swing.JButton();
        jButton27 = new javax.swing.JButton();
        jPanel81 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        infoList = new javax.swing.JList();
        jPanel83 = new javax.swing.JPanel();
        displayCurrent = new javax.swing.JButton();
        refresh = new javax.swing.JButton();
        jPanel_reportFormContainer = new javax.swing.JPanel();
        jSplitPane_Annotations_Comparator = new javax.swing.JSplitPane();
        jPanel49 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jPanel40 = new javax.swing.JPanel();
        jPanel_colorfulTextBar_filebrowser3 = new javax.swing.JPanel();
        jLabel27 = new javax.swing.JLabel();
        jPanel94 = new javax.swing.JPanel();
        jToolBar_editopanel_comparison = new javax.swing.JToolBar();
        jLabel_toolbar_split1 = new javax.swing.JLabel();
        jButton17 = new javax.swing.JButton();
        jButton24 = new javax.swing.JButton();
        jPanel42 = new javax.swing.JPanel();
        jToolBar4 = new javax.swing.JToolBar();
        jLabel_toolbar_split = new javax.swing.JLabel();
        jButton_spaneditor_delete = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        jButton11 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jPanel59 = new javax.swing.JPanel();
        jPanel60 = new UserInterface.AnnotationCompare.ExpandButton(
            jSplitPane_Annotations_Comparator,
            this.jSplitPane_between_viewer_and_allatttibutes,
            jPanel_comparator_container
        );
        jPanel41 = new javax.swing.JPanel();
        jPanel_multipleResultShowList = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jList_selectedAnnotations = new javax.swing.JList();
        jPanel45 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jPanel50 = new javax.swing.JPanel();
        jPanel74 = new javax.swing.JPanel();
        jPanel_annotation_details = new javax.swing.JPanel();
        jPanel64 = new javax.swing.JPanel();
        jPanel65 = new javax.swing.JPanel();
        jPanel55 = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jPanel39 = new javax.swing.JPanel();
        jTextField_spanLocation = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jPanel44 = new javax.swing.JPanel();
        jTextField_annotationClassnames = new javax.swing.JTextField();
        jButton_SelectClass = new javax.swing.JButton();
        jLabel38 = new javax.swing.JLabel();
        jPanel66 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea_comment = new javax.swing.JTextArea();
        jSplitPane5 = new javax.swing.JSplitPane();
        jPanel48 = new javax.swing.JPanel();
        jPanel70 = new javax.swing.JPanel();
        jPanel61 = new javax.swing.JPanel();
        jLabel39 = new javax.swing.JLabel();
        jPanel18 = new javax.swing.JPanel();
        jButton9 = new javax.swing.JToggleButton();
        edit_Relationships = new javax.swing.JButton();
        delete_Relationships = new javax.swing.JButton();
        jScrollPane8 = new javax.swing.JScrollPane();
        jList_complexrelationships = new javax.swing.JList();
        jPanel71 = new javax.swing.JPanel();
        jScrollPane9 = new javax.swing.JScrollPane();
        jList_normalrelationship = new javax.swing.JList();
        jPanel63 = new javax.swing.JPanel();
        jButton_relationships1 = new javax.swing.JButton();
        jLabel40 = new javax.swing.JLabel();
        jPanel75 = new javax.swing.JPanel();
        jPanel76 = new javax.swing.JPanel();
        jLabel37 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jTextField_creationdate = new javax.swing.JTextField();
        jTextField_annotator = new javax.swing.JTextField();
        jPanel87 = new javax.swing.JPanel();
        jPanel84 = new javax.swing.JPanel();
        jPanel68 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane6 = new javax.swing.JScrollPane();
        suggestions = new javax.swing.JList();
        jPanel27 = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        jTextPane_explanations = new javax.swing.JTextPane();
        jPanel_colorfulTextBar_filebrowser4 = new javax.swing.JPanel();
        jPanel69 = new javax.swing.JPanel();
        jButton12 = new javax.swing.JButton();
        jPanel72 = new javax.swing.JPanel();
        jLabel41 = new javax.swing.JLabel();
        jScrollPane10 = new javax.swing.JScrollPane();
        jList3 = new javax.swing.JList();
        jPanel_colorfulTextBar_filebrowser7 = new javax.swing.JPanel();
        jLabel42 = new javax.swing.JLabel();
        jPanel_comparator_container = new javax.swing.JPanel();
        jPanel_NLP = new javax.swing.JPanel();
        jPanel_textPane = new javax.swing.JPanel();
        JPanel_PinsExtractor = new javax.swing.JPanel();
        jPanel_Converter = new javax.swing.JPanel();

        jFileChooser1.setMultiSelectionEnabled(true);

        confirmExit.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        confirmExit.setTitle("Closing?");
        confirmExit.setAlwaysOnTop(true);
        confirmExit.setResizable(false);

        jPanel13.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(238, 238, 238), 4));
        jPanel13.setMaximumSize(new java.awt.Dimension(388, 136));
        jPanel13.setLayout(new java.awt.BorderLayout());

        jPanel14.setLayout(new java.awt.BorderLayout());

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/imac_01.png"))); // NOI18N
        jPanel14.add(jLabel5, java.awt.BorderLayout.CENTER);

        jPanel13.add(jPanel14, java.awt.BorderLayout.WEST);

        jPanel15.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel6.setFont(new java.awt.Font("Calibri", 0, 18));
        jLabel6.setText("Are you leaving eHOST?");
        jPanel15.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 26, 232, 22));

        jPanel13.add(jPanel15, java.awt.BorderLayout.CENTER);

        confirmExit.getContentPane().add(jPanel13, java.awt.BorderLayout.NORTH);

        jPanel16.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(238, 238, 238), 3));
        jPanel16.setLayout(new java.awt.BorderLayout());

        jButton7.setFont(new java.awt.Font("Calibri", 1, 15));
        jButton7.setText("Yes");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jButton6.setFont(new java.awt.Font("Calibri", 1, 15));
        jButton6.setText("No");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel22Layout = new org.jdesktop.layout.GroupLayout(jPanel22);
        jPanel22.setLayout(jPanel22Layout);
        jPanel22Layout.setHorizontalGroup(
            jPanel22Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel22Layout.createSequentialGroup()
                .addContainerGap()
                .add(jButton7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 78, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 87, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel22Layout.setVerticalGroup(
            jPanel22Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel22Layout.createSequentialGroup()
                .add(jPanel22Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jButton7)
                    .add(jButton6))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel16.add(jPanel22, java.awt.BorderLayout.EAST);

        confirmExit.getContentPane().add(jPanel16, java.awt.BorderLayout.CENTER);

        res_conflictIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/conflictHuman.png"))); // NOI18N
        res_conflictIcon.setText("jLabel38");

        jTextField_sample.setText("jTextField1");

        jLabel_icon_annotationlist.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/userInputIcon.png"))); // NOI18N
        jLabel_icon_annotationlist.setText("jLabel9");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("eHOST - V00.08.20100610");
        setBackground(new java.awt.Color(132, 122, 122));
        addWindowFocusListener(new java.awt.event.WindowFocusListener() {
            public void windowGainedFocus(java.awt.event.WindowEvent evt) {
                formWindowGainedFocus(evt);
            }
            public void windowLostFocus(java.awt.event.WindowEvent evt) {
            }
        });
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
        });
        addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                formFocusGained(evt);
            }
        });

        ToolBar.setBackground(new java.awt.Color(200, 200, 200));
        ToolBar.setFloatable(false);
        ToolBar.setRollover(true);

        buttonGroup_Tabs.add(jToggleButton_ResultEditor);
        jToggleButton_ResultEditor.setFont(new java.awt.Font("Segoe UI", 1, 12));
        jToggleButton_ResultEditor.setForeground(new java.awt.Color(41, 41, 41));
        jToggleButton_ResultEditor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/annotator.png"))); // NOI18N
        jToggleButton_ResultEditor.setSelected(true);
        jToggleButton_ResultEditor.setFocusable(false);
        jToggleButton_ResultEditor.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToggleButton_ResultEditor.setLabel("<html>Result<br>Editor<html> ");
        jToggleButton_ResultEditor.setMaximumSize(new java.awt.Dimension(90, 100));
        jToggleButton_ResultEditor.setMinimumSize(new java.awt.Dimension(90, 0));
        jToggleButton_ResultEditor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToggleButton_ResultEditor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton_ResultEditorActionPerformed(evt);
            }
        });
        ToolBar.add(jToggleButton_ResultEditor);

        buttonGroup_Tabs.add(jToggleButton_CreateAnnotaion);
        jToggleButton_CreateAnnotaion.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
        jToggleButton_CreateAnnotaion.setForeground(new java.awt.Color(0, 102, 102));
        jToggleButton_CreateAnnotaion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/annotator.png"))); // NOI18N
        jToggleButton_CreateAnnotaion.setText("<html>NLP<br>Assisted<html> ");
        jToggleButton_CreateAnnotaion.setFocusable(false);
        jToggleButton_CreateAnnotaion.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToggleButton_CreateAnnotaion.setMaximumSize(new java.awt.Dimension(106, 100));
        jToggleButton_CreateAnnotaion.setMinimumSize(new java.awt.Dimension(106, 0));
        jToggleButton_CreateAnnotaion.setPreferredSize(new java.awt.Dimension(106, 43));
        jToggleButton_CreateAnnotaion.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToggleButton_CreateAnnotaion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton_CreateAnnotaionActionPerformed(evt);
            }
        });
        /*
        ToolBar.add(jToggleButton_CreateAnnotaion);
        */

        buttonGroup_Tabs.add(jToggleButton_PinExtractor);
        jToggleButton_PinExtractor.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
        jToggleButton_PinExtractor.setForeground(new java.awt.Color(41, 41, 41));
        jToggleButton_PinExtractor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/run.png"))); // NOI18N
        jToggleButton_PinExtractor.setText("<html>Pin<br>Extractor<html> ");
        jToggleButton_PinExtractor.setFocusable(false);
        jToggleButton_PinExtractor.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToggleButton_PinExtractor.setMaximumSize(new java.awt.Dimension(90, 100));
        jToggleButton_PinExtractor.setMinimumSize(new java.awt.Dimension(90, 0));
        jToggleButton_PinExtractor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToggleButton_PinExtractor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton_PinExtractorActionPerformed(evt);
            }
        });
        /*
        ToolBar.add(jToggleButton_PinExtractor);
        */

        buttonGroup_Tabs.add(jToggleButton_DictionaryManager);
        jToggleButton_DictionaryManager.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
        jToggleButton_DictionaryManager.setForeground(new java.awt.Color(41, 41, 41));
        jToggleButton_DictionaryManager.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/run.png"))); // NOI18N
        jToggleButton_DictionaryManager.setText("<html>Dictionary<br>Manager<html> ");
        jToggleButton_DictionaryManager.setFocusable(false);
        jToggleButton_DictionaryManager.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToggleButton_DictionaryManager.setMaximumSize(new java.awt.Dimension(100, 100));
        jToggleButton_DictionaryManager.setMinimumSize(new java.awt.Dimension(100, 0));
        jToggleButton_DictionaryManager.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToggleButton_DictionaryManager.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton_DictionaryManagerActionPerformed(evt);
            }
        });
        /*
        ToolBar.add(jToggleButton_DictionaryManager);
        */

        buttonGroup_Tabs.add(jToggleButton_Converter);
        jToggleButton_Converter.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
        jToggleButton_Converter.setForeground(new java.awt.Color(41, 41, 41));
        jToggleButton_Converter.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/configure.png"))); // NOI18N
        jToggleButton_Converter.setText("<html>Converter</html> ");
        jToggleButton_Converter.setFocusable(false);
        jToggleButton_Converter.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToggleButton_Converter.setMaximumSize(new java.awt.Dimension(110, 100));
        jToggleButton_Converter.setMinimumSize(new java.awt.Dimension(110, 0));
        jToggleButton_Converter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton_ConverterActionPerformed(evt);
            }
        });
        /*
        ToolBar.add(jToggleButton_Converter);
        */

        buttonGroup_Tabs.add(jToggleButton_DictionaryManager1);
        jToggleButton_DictionaryManager1.setFont(new java.awt.Font("Segoe UI", 1, 12));
        jToggleButton_DictionaryManager1.setForeground(new java.awt.Color(41, 41, 41));
        jToggleButton_DictionaryManager1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/run.png"))); // NOI18N
        jToggleButton_DictionaryManager1.setText("<html>Assignments<html> ");
        jToggleButton_DictionaryManager1.setFocusable(false);
        jToggleButton_DictionaryManager1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToggleButton_DictionaryManager1.setMaximumSize(new java.awt.Dimension(150, 100));
        jToggleButton_DictionaryManager1.setMinimumSize(new java.awt.Dimension(100, 0));
        jToggleButton_DictionaryManager1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton_DictionaryManager1ActionPerformed(evt);
            }
        });
        ToolBar.add(jToggleButton_DictionaryManager1);

        buttonGroup_Tabs.add(jToggleButton_DictionarySetting);
        jToggleButton_DictionarySetting.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
        jToggleButton_DictionarySetting.setForeground(new java.awt.Color(41, 41, 41));
        jToggleButton_DictionarySetting.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/configure.png"))); // NOI18N
        jToggleButton_DictionarySetting.setText("<html>Dictionary<br>Setting<html> ");
        jToggleButton_DictionarySetting.setFocusable(false);
        jToggleButton_DictionarySetting.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToggleButton_DictionarySetting.setMaximumSize(new java.awt.Dimension(110, 100));
        jToggleButton_DictionarySetting.setMinimumSize(new java.awt.Dimension(110, 0));
        jToggleButton_DictionarySetting.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToggleButton_DictionarySetting.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton_DictionarySettingActionPerformed(evt);
            }
        });
        /*
        ToolBar.add(jToggleButton_DictionarySetting);
        */

        buttonGroup_Tabs.add(jToggleButton_exit);
        jToggleButton_exit.setFont(new java.awt.Font("Segoe UI", 1, 12));
        jToggleButton_exit.setForeground(new java.awt.Color(102, 0, 51));
        jToggleButton_exit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/exit.png"))); // NOI18N
        jToggleButton_exit.setFocusable(false);
        jToggleButton_exit.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToggleButton_exit.setLabel("EXIT ");
        jToggleButton_exit.setMaximumSize(new java.awt.Dimension(100, 100));
        jToggleButton_exit.setMinimumSize(new java.awt.Dimension(100, 0));
        jToggleButton_exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton_exitActionPerformed(evt);
            }
        });
        ToolBar.add(jToggleButton_exit);

        getContentPane().add(ToolBar, java.awt.BorderLayout.NORTH);

        BottomInfoBar.setBackground(new java.awt.Color(183, 183, 183));
        BottomInfoBar.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(183, 183, 183), 3));
        BottomInfoBar.setPreferredSize(new java.awt.Dimension(500, 25));
        BottomInfoBar.setRequestFocusEnabled(false);
        BottomInfoBar.setVerifyInputWhenFocusTarget(false);
        BottomInfoBar.setLayout(new java.awt.BorderLayout());

        jPanel1.setBackground(new java.awt.Color(183, 183, 183));
        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
        BottomInfoBar.add(jPanel1, java.awt.BorderLayout.WEST);

        jPanel_infobar_right_current_annotator.setBackground(new java.awt.Color(183, 183, 183));
        jPanel_infobar_right_current_annotator.setForeground(new java.awt.Color(204, 204, 204));
        jPanel_infobar_right_current_annotator.setLayout(new java.awt.BorderLayout());

        jLabel_info_annotator.setFont(new java.awt.Font("Courier New", 1, 12));
        jLabel_info_annotator.setText("jLabel18");
        jLabel_info_annotator.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel_info_annotatorMouseClicked(evt);
            }
        });
        jPanel_infobar_right_current_annotator.add(jLabel_info_annotator, java.awt.BorderLayout.CENTER);

        jPanel2.setBackground(new java.awt.Color(183, 183, 183));
        jPanel2.setLayout(new java.awt.BorderLayout());

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jPanel2.add(jSeparator1, java.awt.BorderLayout.WEST);

        jLabel_info_annotatorlabel.setFont(new java.awt.Font("Courier New", 1, 12));
        jLabel_info_annotatorlabel.setForeground(new java.awt.Color(0, 102, 102));
        jLabel_info_annotatorlabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/User-2-icon.png"))); // NOI18N
        jLabel_info_annotatorlabel.setText(" ");
        jLabel_info_annotatorlabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel_info_annotatorMouseClicked(evt);
            }
        });
        jPanel2.add(jLabel_info_annotatorlabel, java.awt.BorderLayout.CENTER);

        jPanel_infobar_right_current_annotator.add(jPanel2, java.awt.BorderLayout.WEST);

        BottomInfoBar.add(jPanel_infobar_right_current_annotator, java.awt.BorderLayout.EAST);

        jPanel_infobar_center.setBackground(new java.awt.Color(183, 183, 183));
        jPanel_infobar_center.setLayout(new java.awt.BorderLayout());

        jLabel_infobar.setBackground(new java.awt.Color(183, 183, 183));
        jLabel_infobar.setFont(new java.awt.Font("Candara", 0, 12));
        jLabel_infobar.setText("jLabel1");
        jLabel_infobar.setMinimumSize(new java.awt.Dimension(400, 16));
        jLabel_infobar.setPreferredSize(new java.awt.Dimension(400, 16));
        jPanel_infobar_center.add(jLabel_infobar, java.awt.BorderLayout.CENTER);

        jPanel58.setBackground(new java.awt.Color(183, 183, 183));

        jLabel_infobar_FlagOfOracle.setFont(new java.awt.Font("Courier New", 1, 12));
        jLabel_infobar_FlagOfOracle.setForeground(new java.awt.Color(0, 102, 102));
        jLabel_infobar_FlagOfOracle.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/oracle_icon_s_disabled.png"))); // NOI18N
        jLabel_infobar_FlagOfOracle.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel_infobar_FlagOfOraclejLabel_info_annotatorMouseClicked(evt);
            }
        });

        jSeparator2.setPreferredSize(new java.awt.Dimension(8, 0));

        jLabel_infobar_FlagOfPath.setFont(new java.awt.Font("Courier New", 1, 12));
        jLabel_infobar_FlagOfPath.setForeground(new java.awt.Color(0, 102, 102));
        jLabel_infobar_FlagOfPath.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/object-to-path_enabled.png"))); // NOI18N
        jLabel_infobar_FlagOfPath.setToolTipText("<html>Show Annotation Complex Relationships<br>in graph pathes.</html>");
        jLabel_infobar_FlagOfPath.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel_infobar_FlagOfPathjLabel_info_annotatorMouseClicked(evt);
            }
        });

        jLabel_infobar_FlagOfDiff.setFont(new java.awt.Font("Courier New", 1, 12));
        jLabel_infobar_FlagOfDiff.setForeground(new java.awt.Color(0, 102, 102));
        jLabel_infobar_FlagOfDiff.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/path-difference.png"))); // NOI18N
        jLabel_infobar_FlagOfDiff.setToolTipText(" Difference Matching");
        jLabel_infobar_FlagOfDiff.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel_infobar_FlagOfDiffMouseClicked(evt);
            }
        });

        jLabel22.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/fire.png"))); // NOI18N
        jLabel22.setToolTipText("Hot keys");
        jLabel22.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jLabel22MouseReleased(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel58Layout = new org.jdesktop.layout.GroupLayout(jPanel58);
        jPanel58.setLayout(jPanel58Layout);
        jPanel58Layout.setHorizontalGroup(
            jPanel58Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel58Layout.createSequentialGroup()
                .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(jLabel_infobar_FlagOfOracle)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel_infobar_FlagOfPath)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel_infobar_FlagOfDiff)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jLabel22)
                .addContainerGap())
        );
        jPanel58Layout.setVerticalGroup(
            jPanel58Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel58Layout.createSequentialGroup()
                .add(jPanel58Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel_infobar_FlagOfOracle, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel_infobar_FlagOfPath, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel_infobar_FlagOfDiff, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel22))
                .addContainerGap())
        );

        jPanel_infobar_center.add(jPanel58, java.awt.BorderLayout.EAST);

        BottomInfoBar.add(jPanel_infobar_center, java.awt.BorderLayout.CENTER);

        getContentPane().add(BottomInfoBar, java.awt.BorderLayout.SOUTH);

        GUIContainer.setBackground(new java.awt.Color(237, 237, 237));
        GUIContainer.setForeground(new java.awt.Color(204, 204, 204));
        GUIContainer.setPreferredSize(new java.awt.Dimension(890, 440));
        GUIContainer.setRequestFocusEnabled(false);
        GUIContainer.setVerifyInputWhenFocusTarget(false);
        GUIContainer.setLayout(new java.awt.CardLayout());

        Editor.setBackground(new java.awt.Color(102, 102, 102));
        Editor.setLayout(new java.awt.BorderLayout());

        NavigationPanel1.setPreferredSize(new java.awt.Dimension(200, 485));
        NavigationPanel1.setLayout(new java.awt.BorderLayout());

        jPanel_NAV_CardContainer.setLayout(new java.awt.CardLayout());

        jPanel_NAV_Card1.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 2, 1, 1, new java.awt.Color(0, 0, 51)));
        jPanel_NAV_Card1.setLayout(new java.awt.BorderLayout());

        jPanel8_topBar.setBackground(new java.awt.Color(0, 51, 102));
        jPanel8_topBar.setLayout(new java.awt.BorderLayout());

        jLabel31.setBackground(new java.awt.Color(41, 119, 167));
        jLabel31.setFont(new java.awt.Font("Calibri", 1, 13));
        jLabel31.setForeground(new java.awt.Color(204, 204, 204));
        jLabel31.setText("WORKSPACE & PROJECT");
        jLabel31.setMaximumSize(new java.awt.Dimension(5000, 19));
        jLabel31.setMinimumSize(new java.awt.Dimension(1, 1));
        jLabel31.setPreferredSize(new java.awt.Dimension(200, 19));
        jLabel31.setRequestFocusEnabled(false);
        jLabel31.setVerifyInputWhenFocusTarget(false);
        jPanel8_topBar.add(jLabel31, java.awt.BorderLayout.CENTER);

        jPanel_NAV_Card1.add(jPanel8_topBar, java.awt.BorderLayout.NORTH);

        jPanel8_bottomBar.setBackground(new java.awt.Color(237, 237, 237));
        jPanel8_bottomBar.setLayout(new java.awt.GridLayout(1, 2, 2, 0));

        jButton_AddClinicalTexts1.setFont(new java.awt.Font("Calibri", 0, 13));
        jButton_AddClinicalTexts1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/add.png"))); // NOI18N
        jButton_AddClinicalTexts1.setText("New");
        jButton_AddClinicalTexts1.setDefaultCapable(false);
        jButton_AddClinicalTexts1.setFocusable(false);
        jButton_AddClinicalTexts1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jButton_AddClinicalTexts1.setMaximumSize(new java.awt.Dimension(100, 27));
        jButton_AddClinicalTexts1.setMinimumSize(new java.awt.Dimension(100, 27));
        jButton_AddClinicalTexts1.setPreferredSize(new java.awt.Dimension(100, 27));
        jButton_AddClinicalTexts1.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton_AddClinicalTexts1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_AddClinicalTexts1ActionPerformed(evt);
            }
        });
        jPanel8_bottomBar.add(jButton_AddClinicalTexts1);

        jButton26.setFont(new java.awt.Font("Calibri", 0, 13));
        jButton26.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/delete.png"))); // NOI18N
        jButton26.setText("Delete");
        jButton26.setFocusable(false);
        jButton26.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jButton26.setMinimumSize(new java.awt.Dimension(90, 27));
        jButton26.setPreferredSize(new java.awt.Dimension(77, 30));
        jButton26.setVerifyInputWhenFocusTarget(false);
        jButton26.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton26ActionPerformed(evt);
            }
        });
        jPanel8_bottomBar.add(jButton26);

        jPanel_NAV_Card1.add(jPanel8_bottomBar, java.awt.BorderLayout.SOUTH);

        jPanel88.setBackground(new java.awt.Color(237, 237, 237));
        jPanel88.setLayout(new java.awt.BorderLayout());

        jPanel8_currentWorkSpace.setBackground(new java.awt.Color(237, 237, 237));
        jPanel8_currentWorkSpace.setBorder(javax.swing.BorderFactory.createMatteBorder(4, 4, 2, 4, new java.awt.Color(237, 237, 237)));
        jPanel8_currentWorkSpace.setMaximumSize(new java.awt.Dimension(297, 87));
        jPanel8_currentWorkSpace.setPreferredSize(new java.awt.Dimension(197, 87));
        jPanel8_currentWorkSpace.setLayout(new java.awt.BorderLayout());

        jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/workspace2.png"))); // NOI18N
        jPanel8_currentWorkSpace.add(jLabel18, java.awt.BorderLayout.WEST);

        jPanel95.setBackground(new java.awt.Color(237, 237, 237));
        jPanel95.setLayout(new java.awt.GridLayout(3, 0));

        jLabel9.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel9.setText(" My WorkSpace:");
        jPanel95.add(jLabel9);

        jComboBox_currentworkspace_abspath.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jComboBox_currentworkspace_abspath.setMinimumSize(null);
        jComboBox_currentworkspace_abspath.setPreferredSize(null);
        jComboBox_currentworkspace_abspath.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBox_currentworkspace_abspathItemStateChanged(evt);
            }
        });
        jPanel95.add(jComboBox_currentworkspace_abspath);

        jPanel17.setBackground(new java.awt.Color(238, 238, 239));

        jButton5.setBackground(new java.awt.Color(255, 255, 255));
        jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/back.png"))); // NOI18N
        jButton5.setText("Change");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel17Layout = new org.jdesktop.layout.GroupLayout(jPanel17);
        jPanel17.setLayout(jPanel17Layout);
        jPanel17Layout.setHorizontalGroup(
            jPanel17Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel17Layout.createSequentialGroup()
                .add(jButton5)
                .addContainerGap(48, Short.MAX_VALUE))
        );
        jPanel17Layout.setVerticalGroup(
            jPanel17Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel17Layout.createSequentialGroup()
                .add(jButton5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel95.add(jPanel17);

        jPanel8_currentWorkSpace.add(jPanel95, java.awt.BorderLayout.CENTER);

        jPanel88.add(jPanel8_currentWorkSpace, java.awt.BorderLayout.NORTH);

        jPanel47.setBackground(new java.awt.Color(238, 238, 237));
        jPanel47.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(238, 238, 237)));
        jPanel47.setLayout(new java.awt.BorderLayout());

        jScrollPane11.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane11.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jList_NAV_projects.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jList_NAV_projects.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jList_NAV_projectsMouseClicked(evt);
            }
        });
        jScrollPane11.setViewportView(jList_NAV_projects);

        jPanel47.add(jScrollPane11, java.awt.BorderLayout.CENTER);

        jPanel91.setBackground(new java.awt.Color(238, 238, 239));
        jPanel91.setLayout(new java.awt.BorderLayout());
        jPanel91.add(jSeparator3, java.awt.BorderLayout.NORTH);

        jLabel20.setFont(new java.awt.Font("Arial", 1, 12));
        jLabel20.setForeground(new java.awt.Color(0, 51, 153));
        jLabel20.setText("Projects in workspace:");
        jPanel91.add(jLabel20, java.awt.BorderLayout.SOUTH);

        jPanel47.add(jPanel91, java.awt.BorderLayout.PAGE_START);

        jPanel88.add(jPanel47, java.awt.BorderLayout.CENTER);

        jPanel_NAV_Card1.add(jPanel88, java.awt.BorderLayout.CENTER);

        jPanel_NAV_CardContainer.add(jPanel_NAV_Card1, "card4");

        jPanel_NAV_Card2.setBackground(new java.awt.Color(0, 51, 102));
        jPanel_NAV_Card2.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 2, 1, 1, new java.awt.Color(0, 0, 51)));
        jPanel_NAV_Card2.setPreferredSize(new java.awt.Dimension(0, 0));
        jPanel_NAV_Card2.setLayout(new java.awt.BorderLayout());

        jPanel8_topBar1.setBackground(new java.awt.Color(0, 51, 102));
        jPanel8_topBar1.setLayout(new java.awt.BorderLayout());

        jLabel32.setBackground(new java.awt.Color(0, 51, 102));
        jLabel32.setFont(new java.awt.Font("Calibri", 1, 13));
        jLabel32.setForeground(new java.awt.Color(204, 204, 204));
        jLabel32.setMaximumSize(new java.awt.Dimension(5000, 19));
        jLabel32.setMinimumSize(new java.awt.Dimension(1, 1));
        jLabel32.setPreferredSize(new java.awt.Dimension(200, 19));
        jLabel32.setRequestFocusEnabled(false);
        jLabel32.setVerifyInputWhenFocusTarget(false);
        jPanel8_topBar1.add(jLabel32, java.awt.BorderLayout.CENTER);

        jPanel_NAV_Card2.add(jPanel8_topBar1, java.awt.BorderLayout.NORTH);

        jPanel8_bottomBar1.setBackground(new java.awt.Color(237, 237, 237));
        jPanel8_bottomBar1.setLayout(new java.awt.GridLayout(1, 0));

        jButton_AddClinicalTexts.setFont(new java.awt.Font("Calibri", 0, 13));
        jButton_AddClinicalTexts.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/add.png"))); // NOI18N
        jButton_AddClinicalTexts.setText("Add files");
        jButton_AddClinicalTexts.setDefaultCapable(false);
        jButton_AddClinicalTexts.setFocusable(false);
        jButton_AddClinicalTexts.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jButton_AddClinicalTexts.setMaximumSize(new java.awt.Dimension(100, 27));
        jButton_AddClinicalTexts.setMinimumSize(new java.awt.Dimension(100, 27));
        jButton_AddClinicalTexts.setPreferredSize(new java.awt.Dimension(100, 27));
        jButton_AddClinicalTexts.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton_AddClinicalTexts.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_AddClinicalTextsActionPerformed(evt);
            }
        });
        jPanel8_bottomBar1.add(jButton_AddClinicalTexts);

        jButton2.setFont(new java.awt.Font("Calibri", 0, 13));
        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/delete.png"))); // NOI18N
        jButton2.setText("Remove");
        jButton2.setFocusable(false);
        jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jButton2.setMaximumSize(new java.awt.Dimension(90, 27));
        jButton2.setMinimumSize(new java.awt.Dimension(90, 27));
        jButton2.setPreferredSize(new java.awt.Dimension(77, 30));
        jButton2.setVerifyInputWhenFocusTarget(false);
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jPanel8_bottomBar1.add(jButton2);

        jPanel_NAV_Card2.add(jPanel8_bottomBar1, java.awt.BorderLayout.SOUTH);

        jPanel_corpuslist_outline.setBackground(new java.awt.Color(237, 237, 237));
        jPanel_corpuslist_outline.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(238, 239, 240), 2));
        jPanel_corpuslist_outline.setLayout(new java.awt.BorderLayout());

        jPanel_corpuslist_innerline.setBackground(new java.awt.Color(238, 238, 239));
        jPanel_corpuslist_innerline.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(51, 51, 51)));
        jPanel_corpuslist_innerline.setLayout(new java.awt.BorderLayout());

        jPanel99.setBackground(new java.awt.Color(255, 255, 255));
        jPanel99.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(238, 238, 237)));
        jPanel99.setLayout(new java.awt.BorderLayout());

        jLabel21.setBackground(new java.awt.Color(255, 255, 255));
        jLabel21.setFont(new java.awt.Font("Arial", 1, 13));
        jLabel21.setForeground(new java.awt.Color(0, 102, 102));
        jLabel21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/return.jpg"))); // NOI18N
        jLabel21.setText("Go back to project list ...");
        jLabel21.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel21MouseClicked(evt);
            }
        });
        jPanel99.add(jLabel21, java.awt.BorderLayout.CENTER);

        jPanel_corpuslist_innerline.add(jPanel99, java.awt.BorderLayout.NORTH);

        jScrollPane12.setBorder(null);
        jScrollPane12.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

        jList_corpus.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jList_corpus.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jList_corpusMouseClicked(evt);
            }
        });
        jScrollPane12.setViewportView(jList_corpus);

        jPanel_corpuslist_innerline.add(jScrollPane12, java.awt.BorderLayout.CENTER);

        jPanel_corpuslist_outline.add(jPanel_corpuslist_innerline, java.awt.BorderLayout.CENTER);

        jPanel_NAV_Card2.add(jPanel_corpuslist_outline, java.awt.BorderLayout.CENTER);

        jPanel_NAV_CardContainer.add(jPanel_NAV_Card2, "card3");

        jPanel_NAV_Card3.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 2, 1, 1, new java.awt.Color(0, 0, 51)));
        jPanel_NAV_Card3.setLayout(new java.awt.BorderLayout());

        jScrollPane_classtree.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
        jScrollPane_classtree.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

        javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("Markables");
        javax.swing.tree.DefaultMutableTreeNode treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("No annotated classes!");
        treeNode1.add(treeNode2);
        jTree_class.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
        jTree_class.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jTree_classMousePressed(evt);
            }
        });
        jTree_class.addTreeExpansionListener(new javax.swing.event.TreeExpansionListener() {
            public void treeExpanded(javax.swing.event.TreeExpansionEvent evt) {
                jTree_classTreeExpanded(evt);
            }
            public void treeCollapsed(javax.swing.event.TreeExpansionEvent evt) {
                jTree_classTreeCollapsed(evt);
            }
        });
        jScrollPane_classtree.setViewportView(jTree_class);

        jPanel_NAV_Card3.add(jScrollPane_classtree, java.awt.BorderLayout.CENTER);

        jPanel_colorfulTextBar_filebrowser6.setBackground(new java.awt.Color(41, 119, 167));
        jPanel_colorfulTextBar_filebrowser6.setLayout(new java.awt.BorderLayout());

        jLabel28.setBackground(new java.awt.Color(41, 119, 167));
        jLabel28.setFont(new java.awt.Font("Calibri", 1, 13));
        jLabel28.setForeground(new java.awt.Color(255, 255, 255));
        jLabel28.setText(" NAVIGATOR");
        jLabel28.setMaximumSize(new java.awt.Dimension(5000, 19));
        jLabel28.setMinimumSize(new java.awt.Dimension(1, 1));
        jLabel28.setPreferredSize(new java.awt.Dimension(200, 19));
        jLabel28.setRequestFocusEnabled(false);
        jLabel28.setVerifyInputWhenFocusTarget(false);
        jPanel_colorfulTextBar_filebrowser6.add(jLabel28, java.awt.BorderLayout.CENTER);

        jToolBar5.setBackground(new java.awt.Color(237, 237, 237));
        jToolBar5.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        jToolBar5.setFloatable(false);
        jToolBar5.setBorderPainted(false);
        jToolBar5.setFocusable(false);
        jToolBar5.setRequestFocusEnabled(false);
        jToolBar5.setVerifyInputWhenFocusTarget(false);

        jLabel44.setBackground(new java.awt.Color(238, 238, 239));
        jLabel44.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/breakermono.png"))); // NOI18N
        jLabel44.setOpaque(true);
        jToolBar5.add(jLabel44);

        jButton23.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/classcolor.png"))); // NOI18N
        jButton23.setToolTipText("Annotation Schema Editor");
        jButton23.setBorderPainted(false);
        jButton23.setFocusable(false);
        jButton23.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton23.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton23.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton23.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton23.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton23.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton23ActionPerformed(evt);
            }
        });
        jToolBar5.add(jButton23);

        jLabel45.setBackground(new java.awt.Color(238, 238, 239));
        jLabel45.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/breakermono.png"))); // NOI18N
        jLabel45.setOpaque(true);
        jToolBar5.add(jLabel45);

        jButton15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/relIcon.png"))); // NOI18N
        jButton15.setToolTipText("Relationship Schema Editor");
        jButton15.setBorderPainted(false);
        jButton15.setFocusable(false);
        jButton15.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton15.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton15ActionPerformed(evt);
            }
        });
        jToolBar5.add(jButton15);

        jButton16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/atts.png"))); // NOI18N
        jButton16.setToolTipText("Attribute Schema Editor");
        jButton16.setBorderPainted(false);
        jButton16.setFocusable(false);
        jButton16.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton16.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton16ActionPerformed(evt);
            }
        });
        jToolBar5.add(jButton16);

        jPanel_colorfulTextBar_filebrowser6.add(jToolBar5, java.awt.BorderLayout.SOUTH);

        jPanel_NAV_Card3.add(jPanel_colorfulTextBar_filebrowser6, java.awt.BorderLayout.NORTH);

        jPanel57.setBackground(new java.awt.Color(237, 237, 237));
        jPanel57.setLayout(new java.awt.GridLayout(1, 0));

        buttonGroup_treeview.add(jRadioButton_treeview_currentarticle);
        jRadioButton_treeview_currentarticle.setFont(new java.awt.Font("Calibri", 0, 11));
        jRadioButton_treeview_currentarticle.setSelected(true);
        jRadioButton_treeview_currentarticle.setText("Current Note");
        jRadioButton_treeview_currentarticle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton_treeview_currentarticleActionPerformed(evt);
            }
        });
        jPanel57.add(jRadioButton_treeview_currentarticle);

        buttonGroup_treeview.add(jRadioButton_treeview_overall);
        jRadioButton_treeview_overall.setFont(new java.awt.Font("Calibri", 0, 11));
        jRadioButton_treeview_overall.setText("All Notes");
        jRadioButton_treeview_overall.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton_treeview_overallActionPerformed(evt);
            }
        });
        jPanel57.add(jRadioButton_treeview_overall);

        jPanel_NAV_Card3.add(jPanel57, java.awt.BorderLayout.SOUTH);

        jPanel_NAV_CardContainer.add(jPanel_NAV_Card3, "card2");

        NavigationPanel1.add(jPanel_NAV_CardContainer, java.awt.BorderLayout.CENTER);

        Editor.add(NavigationPanel1, java.awt.BorderLayout.WEST);

        jCardcontainer_interactive.setLayout(new java.awt.CardLayout());

        jSplitPane_between_viewer_and_allatttibutes.setBackground(new java.awt.Color(220, 220, 220));
        jSplitPane_between_viewer_and_allatttibutes.setBorder(null);
        jSplitPane_between_viewer_and_allatttibutes.setDividerLocation(700);
        jSplitPane_between_viewer_and_allatttibutes.setDividerSize(7);
        jSplitPane_between_viewer_and_allatttibutes.setResizeWeight(1.0);

        jPanel_interactive_left.setMinimumSize(new java.awt.Dimension(1, 1));
        jPanel_interactive_left.setPreferredSize(new java.awt.Dimension(200, 166));
        jPanel_interactive_left.setLayout(new java.awt.BorderLayout());

        jPanel73.setBackground(new java.awt.Color(237, 237, 237));
        jPanel73.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(238, 238, 238), 3));
        jPanel73.setLayout(new java.awt.BorderLayout());

        NavigationPanel_editor.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        NavigationPanel_editor.setMaximumSize(new java.awt.Dimension(21, 0));
        NavigationPanel_editor.setMinimumSize(new java.awt.Dimension(21, 21));
        NavigationPanel_editor.setPreferredSize(new java.awt.Dimension(21, 635));

        org.jdesktop.layout.GroupLayout NavigationPanel_editorLayout = new org.jdesktop.layout.GroupLayout(NavigationPanel_editor);
        NavigationPanel_editor.setLayout(NavigationPanel_editorLayout);
        NavigationPanel_editorLayout.setHorizontalGroup(
            NavigationPanel_editorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 17, Short.MAX_VALUE)
        );
        NavigationPanel_editorLayout.setVerticalGroup(
            NavigationPanel_editorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 635, Short.MAX_VALUE)
        );

        jPanel73.add(NavigationPanel_editor, java.awt.BorderLayout.EAST);

        jPanel12.setLayout(new java.awt.BorderLayout());

        jPanel37.setBackground(new java.awt.Color(236, 233, 216));
        jPanel37.setLayout(new java.awt.BorderLayout());

        jPanel_colorfulTextBar_filebrowser2.setBackground(new java.awt.Color(41, 119, 167));
        jPanel_colorfulTextBar_filebrowser2.setLayout(new java.awt.BorderLayout());

        jLabel25.setBackground(new java.awt.Color(41, 119, 167));
        jLabel25.setFont(new java.awt.Font("Calibri", 1, 13));
        jLabel25.setForeground(new java.awt.Color(255, 255, 255));
        jLabel25.setText("  VIEWER");
        jLabel25.setMaximumSize(new java.awt.Dimension(5000, 19));
        jLabel25.setMinimumSize(new java.awt.Dimension(1, 1));
        jLabel25.setPreferredSize(new java.awt.Dimension(200, 19));
        jLabel25.setRequestFocusEnabled(false);
        jLabel25.setVerifyInputWhenFocusTarget(false);
        jPanel_colorfulTextBar_filebrowser2.add(jLabel25, java.awt.BorderLayout.CENTER);

        jPanel37.add(jPanel_colorfulTextBar_filebrowser2, java.awt.BorderLayout.NORTH);

        jPanel8.setBackground(new java.awt.Color(236, 233, 216));
        jPanel8.setLayout(new java.awt.BorderLayout());

        jToolBar3.setBackground(new java.awt.Color(237, 237, 237));
        jToolBar3.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        jToolBar3.setFloatable(false);
        jToolBar3.setBorderPainted(false);
        jToolBar3.setFocusable(false);
        jToolBar3.setRequestFocusEnabled(false);
        jToolBar3.setVerifyInputWhenFocusTarget(false);

        jComboBox_InputFileList.setFont(new java.awt.Font("Calibri", 0, 13));
        jComboBox_InputFileList.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jComboBox_InputFileList.setMaximumSize(new java.awt.Dimension(32767, 22));
        jComboBox_InputFileList.setPreferredSize(new java.awt.Dimension(56, 22));
        jComboBox_InputFileList.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox_InputFileListActionPerformed(evt);
            }
        });
        jToolBar3.add(jComboBox_InputFileList);

        jLabel3.setBackground(new java.awt.Color(238, 238, 239));
        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/breakermono.png"))); // NOI18N
        jLabel3.setOpaque(true);
        jToolBar3.add(jLabel3);

        jButton13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/nextb.png"))); // NOI18N
        jButton13.setToolTipText("Previous Clinical Note");
        jButton13.setBorderPainted(false);
        jButton13.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton13.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton13.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton13ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton13);

        jButton14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/back.png"))); // NOI18N
        jButton14.setToolTipText("Next Clinical Note");
        jButton14.setBorderPainted(false);
        jButton14.setFocusable(false);
        jButton14.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton14.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton14.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton14.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton14ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton14);

        jButton21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/font2.png"))); // NOI18N
        jButton21.setToolTipText("Decrease font size of document");
        jButton21.setBorderPainted(false);
        jButton21.setFocusable(false);
        jButton21.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton21.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton21.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton21.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton21.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar3.add(jButton21);

        jButton22.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/font1.png"))); // NOI18N
        jButton22.setToolTipText("Increase font size of document");
        jButton22.setBorderPainted(false);
        jButton22.setFocusable(false);
        jButton22.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton22.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton22.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton22.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton22.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton22.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton22ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton22);

        jLabel2.setBackground(new java.awt.Color(238, 238, 239));
        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/breakermono.png"))); // NOI18N
        jLabel2.setOpaque(true);
        jToolBar3.add(jLabel2);

        jButton18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/addtab.png"))); // NOI18N
        jButton18.setToolTipText("<html>Import Annotations from knowtator<br> XML files or PINS files.<html>");
        jButton18.setBorderPainted(false);
        jButton18.setFocusable(false);
        jButton18.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton18.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton18.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton18.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton18.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton18ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton18);

        jButton19.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/clearConsoleButtonGlyph.png"))); // NOI18N
        jButton19.setToolTipText("<html>Remove all imported or modified<br> annotations.<html>");
        jButton19.setBorderPainted(false);
        jButton19.setFocusable(false);
        jButton19.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton19.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton19.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton19.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton19.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton19ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton19);

        jLabel4.setBackground(new java.awt.Color(238, 238, 239));
        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/breakermono.png"))); // NOI18N
        jLabel4.setOpaque(true);
        jToolBar3.add(jLabel4);

        jButton_removeduplicates.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/removeduplicates.png"))); // NOI18N
        jButton_removeduplicates.setToolTipText("<html>Remove repetitive annotations</html>");
        jButton_removeduplicates.setBorderPainted(false);
        jButton_removeduplicates.setFocusable(false);
        jButton_removeduplicates.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton_removeduplicates.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton_removeduplicates.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton_removeduplicates.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton_removeduplicates.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton_removeduplicates.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_removeduplicatesActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton_removeduplicates);

        jButton_save.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/save.png"))); // NOI18N
        jButton_save.setToolTipText("<html>Quick Save</html>");
        jButton_save.setBorderPainted(false);
        jButton_save.setFocusable(false);
        jButton_save.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton_save.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton_save.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton_save.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton_save.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_saveActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton_save);

        jButton20.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/saveas.png"))); // NOI18N
        jButton20.setToolTipText("<html>\"SAVE AS\": Export all annotations to knowtator<br> XML or PINS files.</html>");
        jButton20.setBorderPainted(false);
        jButton20.setFocusable(false);
        jButton20.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton20.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton20.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton20.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton20.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton20.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton20ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton20);

        jButton_save1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/images-preannotated.jpg"))); // NOI18N
        jButton_save1.setToolTipText("<html>Pre-Annotated for Pairs</html>");
        jButton_save1.setBorderPainted(false);
        jButton_save1.setFocusable(false);
        jButton_save1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton_save1.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton_save1.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton_save1.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton_save1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton_save1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_save1ActionPerformed(evt);
            }
        });
        jToolBar3.add(jButton_save1);

        jPanel8.add(jToolBar3, java.awt.BorderLayout.CENTER);

        jPanel37.add(jPanel8, java.awt.BorderLayout.CENTER);

        jPanel12.add(jPanel37, java.awt.BorderLayout.PAGE_START);

        jTabbedPane3.setFont(new java.awt.Font("Courier New", 0, 12));
        jTabbedPane3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTabbedPane3MouseClicked(evt);
            }
        });
        jTabbedPane3.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jTabbedPane3StateChanged(evt);
            }
        });

        jPanel36.setBackground(new java.awt.Color(236, 233, 216));
        jPanel36.setMinimumSize(new java.awt.Dimension(1, 1));
        jPanel36.setPreferredSize(new java.awt.Dimension(200, 122));
        jPanel36.setLayout(new java.awt.BorderLayout());

        jPanel43.setBackground(new java.awt.Color(237, 237, 237));
        jPanel43.setMinimumSize(new java.awt.Dimension(1, 1));
        jPanel43.setPreferredSize(new java.awt.Dimension(200, 36));
        jPanel43.setLayout(new java.awt.BorderLayout());

        jLabel_cursor.setForeground(new java.awt.Color(102, 102, 102));
        jPanel43.add(jLabel_cursor, java.awt.BorderLayout.CENTER);

        jPanel38.setBackground(new java.awt.Color(237, 237, 237));
        jPanel38.setLayout(new java.awt.BorderLayout());

        jTextField_searchtext.setBackground(new java.awt.Color(237, 237, 237));
        jTextField_searchtext.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField_searchtextActionPerformed(evt);
            }
        });
        jTextField_searchtext.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextField_searchtextKeyTyped(evt);
            }
        });
        jPanel38.add(jTextField_searchtext, java.awt.BorderLayout.CENTER);

        jButton1.setBackground(new java.awt.Color(237, 237, 237));
        jButton1.setText("Find");
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel38.add(jButton1, java.awt.BorderLayout.EAST);

        jPanel43.add(jPanel38, java.awt.BorderLayout.NORTH);

        jPanel36.add(jPanel43, java.awt.BorderLayout.SOUTH);

        jPanel46.setBackground(new java.awt.Color(237, 237, 237));
        jPanel46.setLayout(new java.awt.BorderLayout());

        jScrollPane_textpane.setBorder(null);

        textPaneforClinicalNotes.setBorder(null);
        textPaneforClinicalNotes.setFont(new java.awt.Font("Symbol", 0, 12));
        textPaneforClinicalNotes.setDoubleBuffered(true);
        textPaneforClinicalNotes.setMinimumSize(new java.awt.Dimension(1, 1));
        textPaneforClinicalNotes.setPreferredSize(new java.awt.Dimension(200, 20));
        textPaneforClinicalNotes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                textPaneforClinicalNotesMouseReleased(evt);
            }
        });
        textPaneforClinicalNotes.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                textPaneforClinicalNotesKeyPressed(evt);
            }
        });
        jScrollPane_textpane.setViewportView(textPaneforClinicalNotes);

        jPanel46.add(jScrollPane_textpane, java.awt.BorderLayout.CENTER);

        jPanel_position_indicator_container.setBackground(new java.awt.Color(237, 237, 237));
        jPanel_position_indicator_container.setPreferredSize(new java.awt.Dimension(15, 540));
        jPanel_position_indicator_container.setLayout(new java.awt.BorderLayout());
        jPanel46.add(jPanel_position_indicator_container, java.awt.BorderLayout.EAST);

        jPanel36.add(jPanel46, java.awt.BorderLayout.CENTER);

        jTabbedPane3.addTab("Text Display", jPanel36);

        jPanel77.setBackground(new java.awt.Color(237, 237, 237));
        jPanel77.setLayout(new java.awt.BorderLayout());

        jPanel78.setBackground(new java.awt.Color(237, 237, 237));
        jPanel78.setLayout(new java.awt.BorderLayout());

        jPanel79.setBackground(new java.awt.Color(237, 237, 237));
        jPanel79.setLayout(new java.awt.BorderLayout());

        jPanel80.setBackground(new java.awt.Color(237, 237, 237));
        jPanel80.setLayout(new java.awt.GridLayout(9, 1, 7, 7));

        jPanel82.setBackground(new java.awt.Color(237, 237, 237));
        jPanel82.setLayout(new java.awt.BorderLayout());

        jLabel26.setFont(new java.awt.Font("Calibri", 1, 14));
        jLabel26.setText("Current Document Summary");
        jPanel82.add(jLabel26, java.awt.BorderLayout.CENTER);

        jPanel80.add(jPanel82);

        classes.setFont(new java.awt.Font("Calibri", 0, 12));
        classes.setText("Number of Markables:");
        classes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                classesMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                classesMouseEntered(evt);
            }
        });
        jPanel80.add(classes);

        annotations.setFont(new java.awt.Font("Calibri", 0, 12));
        annotations.setText("Number of Annotations:");
        annotations.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                annotationsMouseClicked(evt);
            }
        });
        jPanel80.add(annotations);

        annotators.setFont(new java.awt.Font("Calibri", 0, 12));
        annotators.setText("Number of Annotators:");
        annotators.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                annotatorsMouseClicked(evt);
            }
        });
        jPanel80.add(annotators);

        overlapping.setFont(new java.awt.Font("Calibri", 0, 12));
        overlapping.setText("Overlapping Annotations:");
        overlapping.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                overlappingMouseClicked(evt);
            }
        });
        jPanel80.add(overlapping);

        workingConflicts.setFont(new java.awt.Font("Calibri", 0, 12));
        workingConflicts.setText("Annotations in Conflict with Working Set: ");
        workingConflicts.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                workingConflictsMouseClicked(evt);
            }
        });
        jPanel80.add(workingConflicts);

        jPanel86.setBackground(new java.awt.Color(237, 237, 237));
        jPanel86.setLayout(new java.awt.GridLayout(1, 0));

        jPanel92.setBackground(new java.awt.Color(237, 237, 237));
        jPanel92.setLayout(new java.awt.BorderLayout());

        verifierFlagged.setFont(new java.awt.Font("Calibri", 0, 12));
        verifierFlagged.setText("Annotations Flagged by Verifier:");
        jPanel92.add(verifierFlagged, java.awt.BorderLayout.CENTER);

        jPanel86.add(jPanel92);

        jPanel90.setBackground(new java.awt.Color(237, 237, 237));
        jPanel90.setLayout(new java.awt.GridLayout(1, 0));

        verifierOnCurrent.setFont(new java.awt.Font("Calibri", 0, 11));
        verifierOnCurrent.setText("Run Verifier(Current)");
        verifierOnCurrent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                verifierOnCurrentActionPerformed(evt);
            }
        });
        jPanel90.add(verifierOnCurrent);

        verifierOnAll.setText("Run Verifier(All)");
        verifierOnAll.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                verifierOnAllActionPerformed(evt);
            }
        });
        jPanel90.add(verifierOnAll);

        jPanel86.add(jPanel90);

        jPanel80.add(jPanel86);

        jPanel3.setLayout(new java.awt.GridLayout(1, 0));

        jPanel4.setLayout(new java.awt.BorderLayout());
        jPanel3.add(jPanel4);

        jPanel5.setLayout(new java.awt.BorderLayout());
        jPanel3.add(jPanel5);

        jButton8.setText("Verify 2011");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });
        jPanel3.add(jButton8);

        jButton27.setText("Reverify 2011");
        jButton27.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton27ActionPerformed(evt);
            }
        });
        jPanel3.add(jButton27);

        jPanel80.add(jPanel3);

        jPanel81.setBackground(new java.awt.Color(237, 237, 237));
        jPanel81.setLayout(new java.awt.GridLayout(1, 2));

        jLabel1.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel1.setText("Currently Viewing:  ");
        jPanel81.add(jLabel1);

        jLabel29.setFont(new java.awt.Font("Calibri", 0, 12));
        jPanel81.add(jLabel29);

        jPanel80.add(jPanel81);

        jPanel79.add(jPanel80, java.awt.BorderLayout.CENTER);

        jPanel78.add(jPanel79, java.awt.BorderLayout.PAGE_START);

        jScrollPane4.setBackground(new java.awt.Color(237, 237, 237));

        infoList.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                infoListMouseClicked(evt);
            }
        });
        infoList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                infoListValueChanged(evt);
            }
        });
        infoList.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                infoListMouseMoved(evt);
            }
        });
        jScrollPane4.setViewportView(infoList);

        jPanel78.add(jScrollPane4, java.awt.BorderLayout.CENTER);

        jPanel83.setBackground(new java.awt.Color(237, 237, 237));
        jPanel83.setLayout(new java.awt.GridLayout(1, 0));

        displayCurrent.setFont(new java.awt.Font("Calibri", 0, 12));
        displayCurrent.setText("Display Current List In Viewer");
        displayCurrent.setToolTipText("<html>Only show the currently displayed annotations<br> on the clinical notes</html>");
        displayCurrent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                displayCurrentActionPerformed(evt);
            }
        });
        jPanel83.add(displayCurrent);

        refresh.setFont(new java.awt.Font("Calibri", 0, 12));
        refresh.setText("Refresh");
        refresh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                refreshActionPerformed(evt);
            }
        });
        jPanel83.add(refresh);

        jPanel78.add(jPanel83, java.awt.BorderLayout.PAGE_END);

        jPanel77.add(jPanel78, java.awt.BorderLayout.CENTER);

        jTabbedPane3.addTab("Annotation Information", jPanel77);

        jPanel_reportFormContainer.setBackground(new java.awt.Color(237, 237, 237));

        org.jdesktop.layout.GroupLayout jPanel_reportFormContainerLayout = new org.jdesktop.layout.GroupLayout(jPanel_reportFormContainer);
        jPanel_reportFormContainer.setLayout(jPanel_reportFormContainerLayout);
        jPanel_reportFormContainerLayout.setHorizontalGroup(
            jPanel_reportFormContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 652, Short.MAX_VALUE)
        );
        jPanel_reportFormContainerLayout.setVerticalGroup(
            jPanel_reportFormContainerLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 552, Short.MAX_VALUE)
        );

        jTabbedPane3.addTab("Reports", jPanel_reportFormContainer);

        jPanel12.add(jTabbedPane3, java.awt.BorderLayout.CENTER);

        jPanel73.add(jPanel12, java.awt.BorderLayout.CENTER);

        jPanel_interactive_left.add(jPanel73, java.awt.BorderLayout.CENTER);

        jSplitPane_between_viewer_and_allatttibutes.setLeftComponent(jPanel_interactive_left);

        jSplitPane_Annotations_Comparator.setBackground(new java.awt.Color(220, 220, 220));
        jSplitPane_Annotations_Comparator.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(222, 222, 222)));
        jSplitPane_Annotations_Comparator.setDividerLocation(200);
        jSplitPane_Annotations_Comparator.setDividerSize(7);
        jSplitPane_Annotations_Comparator.setResizeWeight(1.0);
        jSplitPane_Annotations_Comparator.setFocusable(false);
        jSplitPane_Annotations_Comparator.setVerifyInputWhenFocusTarget(false);

        jPanel49.setBackground(new java.awt.Color(237, 237, 237));
        jPanel49.setLayout(new java.awt.BorderLayout());

        jPanel9.setMinimumSize(new java.awt.Dimension(1, 1));
        jPanel9.setPreferredSize(new java.awt.Dimension(319, 777));
        jPanel9.setLayout(new java.awt.BorderLayout());

        jPanel40.setBackground(new java.awt.Color(236, 233, 216));
        jPanel40.setPreferredSize(new java.awt.Dimension(390, 238));
        jPanel40.setLayout(new java.awt.BorderLayout());

        jPanel_colorfulTextBar_filebrowser3.setBackground(new java.awt.Color(41, 119, 167));
        jPanel_colorfulTextBar_filebrowser3.setLayout(new java.awt.BorderLayout());

        jLabel27.setBackground(new java.awt.Color(41, 119, 167));
        jLabel27.setFont(new java.awt.Font("Calibri", 1, 13));
        jLabel27.setForeground(new java.awt.Color(255, 255, 255));
        jLabel27.setText("  EDITOR");
        jLabel27.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jLabel27.setMinimumSize(new java.awt.Dimension(1, 1));
        jLabel27.setPreferredSize(new java.awt.Dimension(200, 19));
        jLabel27.setRequestFocusEnabled(false);
        jLabel27.setVerifyInputWhenFocusTarget(false);
        jPanel_colorfulTextBar_filebrowser3.add(jLabel27, java.awt.BorderLayout.NORTH);

        jPanel94.setLayout(new java.awt.BorderLayout());

        jToolBar_editopanel_comparison.setBackground(new java.awt.Color(237, 237, 237));
        jToolBar_editopanel_comparison.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        jToolBar_editopanel_comparison.setFloatable(false);
        jToolBar_editopanel_comparison.setBorderPainted(false);
        jToolBar_editopanel_comparison.setFocusable(false);
        jToolBar_editopanel_comparison.setRequestFocusEnabled(false);
        jToolBar_editopanel_comparison.setVerifyInputWhenFocusTarget(false);

        jLabel_toolbar_split1.setBackground(new java.awt.Color(238, 238, 239));
        jLabel_toolbar_split1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/breakermono.png"))); // NOI18N
        jLabel_toolbar_split1.setOpaque(true);
        jToolBar_editopanel_comparison.add(jLabel_toolbar_split1);

        jButton17.setFont(new java.awt.Font("Calibri", 0, 14));
        jButton17.setText("Accept");
        jButton17.setFocusable(false);
        jButton17.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton17.setMaximumSize(new java.awt.Dimension(52, 24));
        jButton17.setMinimumSize(new java.awt.Dimension(0, 0));
        jButton17.setPreferredSize(new java.awt.Dimension(52, 24));
        jButton17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton17ActionPerformed(evt);
            }
        });
        jToolBar_editopanel_comparison.add(jButton17);

        jButton24.setFont(new java.awt.Font("Calibri", 0, 14));
        jButton24.setText("Reject");
        jButton24.setFocusable(false);
        jButton24.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton24.setMaximumSize(new java.awt.Dimension(52, 24));
        jButton24.setMinimumSize(new java.awt.Dimension(0, 0));
        jButton24.setPreferredSize(new java.awt.Dimension(52, 24));
        jButton24.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton24ActionPerformed(evt);
            }
        });
        jToolBar_editopanel_comparison.add(jButton24);

        jPanel94.add(jToolBar_editopanel_comparison, java.awt.BorderLayout.SOUTH);

        jPanel42.setLayout(new java.awt.BorderLayout());

        jToolBar4.setBackground(new java.awt.Color(237, 237, 237));
        jToolBar4.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        jToolBar4.setFloatable(false);
        jToolBar4.setBorderPainted(false);
        jToolBar4.setFocusable(false);
        jToolBar4.setRequestFocusEnabled(false);
        jToolBar4.setVerifyInputWhenFocusTarget(false);

        jLabel_toolbar_split.setBackground(new java.awt.Color(238, 238, 239));
        jLabel_toolbar_split.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/breakermono.png"))); // NOI18N
        jLabel_toolbar_split.setOpaque(true);
        jToolBar4.add(jLabel_toolbar_split);

        jButton_spaneditor_delete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/closetab.png"))); // NOI18N
        jButton_spaneditor_delete.setToolTipText("Delete selected annotation");
        jButton_spaneditor_delete.setBorderPainted(false);
        jButton_spaneditor_delete.setContentAreaFilled(false);
        jButton_spaneditor_delete.setMaximumSize(new java.awt.Dimension(23, 23));
        jButton_spaneditor_delete.setMinimumSize(new java.awt.Dimension(23, 23));
        jButton_spaneditor_delete.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton_spaneditor_delete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_spaneditor_deleteActionPerformed(evt);
            }
        });
        jToolBar4.add(jButton_spaneditor_delete);

        jLabel8.setBackground(new java.awt.Color(238, 238, 239));
        jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/breakermono.png"))); // NOI18N
        jLabel8.setOpaque(true);
        jToolBar4.add(jLabel8);

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/span_ll.png"))); // NOI18N
        jButton3.setToolTipText("<html>Move the start of the annotation<br>One character to the left.<br>Hotkey(Ctrl + Left Arrow)</html>");
        jButton3.setBorderPainted(false);
        jButton3.setContentAreaFilled(false);
        jButton3.setMaximumSize(new java.awt.Dimension(28, 23));
        jButton3.setMinimumSize(new java.awt.Dimension(1, 1));
        jButton3.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jToolBar4.add(jButton3);

        jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/span_lr.png"))); // NOI18N
        jButton10.setToolTipText("<html>Move the start of the annotation<br>One character to the right.<br>Hotkey(Ctrl + Right Arrow)</html>");
        jButton10.setBorderPainted(false);
        jButton10.setContentAreaFilled(false);
        jButton10.setMaximumSize(new java.awt.Dimension(28, 23));
        jButton10.setMinimumSize(new java.awt.Dimension(1, 1));
        jButton10.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });
        jToolBar4.add(jButton10);

        jButton11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/span_rl.png"))); // NOI18N
        jButton11.setToolTipText("<html>Move the end of the annotation<br>One character to the left.<br>Hotkey(Alt + Left Arrow)</html>");
        jButton11.setBorderPainted(false);
        jButton11.setContentAreaFilled(false);
        jButton11.setMaximumSize(new java.awt.Dimension(28, 23));
        jButton11.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });
        jToolBar4.add(jButton11);

        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/span_rr.png"))); // NOI18N
        jButton4.setToolTipText("<html>Move the end of the annotation<br>One character to the right.<br>Hotkey(Alt + Right Arrow)</html>");
        jButton4.setBorderPainted(false);
        jButton4.setContentAreaFilled(false);
        jButton4.setMaximumSize(new java.awt.Dimension(28, 23));
        jButton4.setMinimumSize(new java.awt.Dimension(1, 1));
        jButton4.setPreferredSize(new java.awt.Dimension(23, 23));
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        jToolBar4.add(jButton4);

        jPanel42.add(jToolBar4, java.awt.BorderLayout.CENTER);

        jPanel59.setBackground(new java.awt.Color(237, 237, 237));
        jPanel59.setLayout(new java.awt.BorderLayout());

        jPanel60.setBackground(new java.awt.Color(237, 237, 237));

        org.jdesktop.layout.GroupLayout jPanel60Layout = new org.jdesktop.layout.GroupLayout(jPanel60);
        jPanel60.setLayout(jPanel60Layout);
        jPanel60Layout.setHorizontalGroup(
            jPanel60Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 58, Short.MAX_VALUE)
        );
        jPanel60Layout.setVerticalGroup(
            jPanel60Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 28, Short.MAX_VALUE)
        );

        jPanel59.add(jPanel60, java.awt.BorderLayout.CENTER);

        jPanel42.add(jPanel59, java.awt.BorderLayout.EAST);

        jPanel94.add(jPanel42, java.awt.BorderLayout.NORTH);

        jPanel_colorfulTextBar_filebrowser3.add(jPanel94, java.awt.BorderLayout.CENTER);

        jPanel40.add(jPanel_colorfulTextBar_filebrowser3, java.awt.BorderLayout.NORTH);

        jPanel41.setBackground(new java.awt.Color(237, 237, 237));
        jPanel41.setMaximumSize(new java.awt.Dimension(32767, 280));
        jPanel41.setMinimumSize(new java.awt.Dimension(1, 1));
        jPanel41.setLayout(new java.awt.GridLayout(1, 2, 4, 2));

        jPanel_multipleResultShowList.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(240, 240, 240), 3));
        jPanel_multipleResultShowList.setMinimumSize(new java.awt.Dimension(0, 0));
        jPanel_multipleResultShowList.setLayout(new java.awt.BorderLayout());

        jScrollPane5.setBorder(null);
        jScrollPane5.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane5.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        jScrollPane5.setMinimumSize(null);

        jList_selectedAnnotations.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jList_selectedAnnotations.setFont(new java.awt.Font("Calibri", 0, 11)); // NOI18N
        jList_selectedAnnotations.setSelectionBackground(new java.awt.Color(74, 136, 218));
        jList_selectedAnnotations.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jList_selectedAnnotationsMousePressed(evt);
            }
        });
        jList_selectedAnnotations.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jList_selectedAnnotationsValueChanged(evt);
            }
        });
        jList_selectedAnnotations.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jList_selectedAnnotationsKeyPressed(evt);
            }
        });
        jScrollPane5.setViewportView(jList_selectedAnnotations);

        jPanel_multipleResultShowList.add(jScrollPane5, java.awt.BorderLayout.CENTER);

        jPanel45.setBackground(new java.awt.Color(237, 237, 237));

        jLabel12.setBackground(new java.awt.Color(236, 233, 216));
        jLabel12.setFont(new java.awt.Font("Calibri", 1, 13));
        jLabel12.setForeground(new java.awt.Color(102, 102, 102));
        jLabel12.setText("Selected Annotations:");
        jLabel12.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jLabel12.setMaximumSize(new java.awt.Dimension(0, 25));
        jLabel12.setMinimumSize(new java.awt.Dimension(0, 25));
        jLabel12.setPreferredSize(new java.awt.Dimension(0, 16));
        jLabel12.setRequestFocusEnabled(false);
        jLabel12.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        org.jdesktop.layout.GroupLayout jPanel45Layout = new org.jdesktop.layout.GroupLayout(jPanel45);
        jPanel45.setLayout(jPanel45Layout);
        jPanel45Layout.setHorizontalGroup(
            jPanel45Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel45Layout.createSequentialGroup()
                .add(jLabel12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 203, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel45Layout.setVerticalGroup(
            jPanel45Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jLabel12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        );

        jPanel_multipleResultShowList.add(jPanel45, java.awt.BorderLayout.NORTH);

        jPanel50.setBackground(new java.awt.Color(237, 237, 237));
        jPanel50.setLayout(new java.awt.GridLayout(2, 0, 0, 2));

        jPanel74.setLayout(new java.awt.BorderLayout());
        jPanel50.add(jPanel74);

        jPanel_multipleResultShowList.add(jPanel50, java.awt.BorderLayout.SOUTH);

        jPanel41.add(jPanel_multipleResultShowList);

        jPanel_annotation_details.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(240, 240, 240), 2));
        jPanel_annotation_details.setLayout(new java.awt.BorderLayout());

        org.jdesktop.layout.GroupLayout jPanel64Layout = new org.jdesktop.layout.GroupLayout(jPanel64);
        jPanel64.setLayout(jPanel64Layout);
        jPanel64Layout.setHorizontalGroup(
            jPanel64Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 93, Short.MAX_VALUE)
        );
        jPanel64Layout.setVerticalGroup(
            jPanel64Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 0, Short.MAX_VALUE)
        );

        jPanel_annotation_details.add(jPanel64, java.awt.BorderLayout.NORTH);

        jPanel65.setBackground(new java.awt.Color(237, 237, 237));
        jPanel65.setLayout(new java.awt.BorderLayout());

        jPanel55.setBackground(new java.awt.Color(237, 237, 237));
        jPanel55.setMaximumSize(new java.awt.Dimension(2147483647, 103));
        jPanel55.setPreferredSize(new java.awt.Dimension(0, 103));
        jPanel55.setLayout(new java.awt.BorderLayout());

        jLabel17.setBackground(new java.awt.Color(236, 233, 216));
        jLabel17.setFont(new java.awt.Font("Calibri", 0, 13));
        jLabel17.setForeground(new java.awt.Color(153, 153, 153));
        jLabel17.setText("Span:");
        jLabel17.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jLabel17.setMaximumSize(new java.awt.Dimension(0, 25));
        jLabel17.setMinimumSize(new java.awt.Dimension(0, 25));
        jLabel17.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel55.add(jLabel17, java.awt.BorderLayout.NORTH);

        jPanel39.setBackground(new java.awt.Color(237, 237, 237));
        jPanel39.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(240, 240, 240), 2));
        jPanel39.setMaximumSize(new java.awt.Dimension(32767, 112));
        jPanel39.setMinimumSize(new java.awt.Dimension(0, 0));
        jPanel39.setPreferredSize(new java.awt.Dimension(106, 132));
        jPanel39.setLayout(new java.awt.GridLayout(4, 0, 0, 2));

        jTextField_spanLocation.setFont(new java.awt.Font("Calibri", 0, 13));
        jTextField_spanLocation.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        jTextField_spanLocation.setMaximumSize(null);
        jTextField_spanLocation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField_spanLocationActionPerformed(evt);
            }
        });
        jPanel39.add(jTextField_spanLocation);

        jLabel16.setBackground(new java.awt.Color(236, 233, 216));
        jLabel16.setFont(new java.awt.Font("Calibri", 0, 13));
        jLabel16.setForeground(new java.awt.Color(153, 153, 153));
        jLabel16.setText("Markable:");
        jLabel16.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jLabel16.setMaximumSize(new java.awt.Dimension(0, 25));
        jLabel16.setMinimumSize(new java.awt.Dimension(0, 25));
        jLabel16.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel39.add(jLabel16);

        jPanel44.setBackground(new java.awt.Color(237, 237, 237));
        jPanel44.setLayout(new java.awt.BorderLayout());

        jTextField_annotationClassnames.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        jTextField_annotationClassnames.setEnabled(false);
        jPanel44.add(jTextField_annotationClassnames, java.awt.BorderLayout.CENTER);

        jButton_SelectClass.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/instancewatch.png"))); // NOI18N
        jButton_SelectClass.setToolTipText("Change category of current annotation.");
        jButton_SelectClass.setFocusable(false);
        jButton_SelectClass.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton_SelectClass.setMargin(new java.awt.Insets(2, 2, 2, 2));
        jButton_SelectClass.setPreferredSize(new java.awt.Dimension(20, 20));
        jButton_SelectClass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_SelectClassActionPerformed(evt);
            }
        });
        jPanel44.add(jButton_SelectClass, java.awt.BorderLayout.EAST);

        jPanel39.add(jPanel44);

        jLabel38.setBackground(new java.awt.Color(236, 233, 216));
        jLabel38.setFont(new java.awt.Font("Calibri", 0, 13));
        jLabel38.setForeground(new java.awt.Color(153, 153, 153));
        jLabel38.setText("Annotation Comment:");
        jLabel38.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jLabel38.setMaximumSize(new java.awt.Dimension(0, 25));
        jLabel38.setMinimumSize(new java.awt.Dimension(0, 25));
        jLabel38.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel39.add(jLabel38);

        jPanel55.add(jPanel39, java.awt.BorderLayout.CENTER);

        jPanel65.add(jPanel55, java.awt.BorderLayout.NORTH);

        jPanel66.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(240, 240, 240), 2));
        jPanel66.setLayout(new java.awt.BorderLayout());

        jScrollPane2.setBorder(null);
        jScrollPane2.setViewportBorder(javax.swing.BorderFactory.createEtchedBorder());

        jTextArea_comment.setBackground(new java.awt.Color(240, 240, 240));
        jTextArea_comment.setColumns(20);
        jTextArea_comment.setEditable(false);
        jTextArea_comment.setFont(new java.awt.Font("Calibri", 0, 13));
        jTextArea_comment.setLineWrap(true);
        jTextArea_comment.setRows(5);
        jTextArea_comment.setBorder(null);
        jTextArea_comment.setDisabledTextColor(new java.awt.Color(0, 1, 0));
        jTextArea_comment.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextArea_commentMouseClicked(evt);
            }
        });
        jTextArea_comment.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jTextArea_commentFocusLost(evt);
            }
        });
        jScrollPane2.setViewportView(jTextArea_comment);

        jPanel66.add(jScrollPane2, java.awt.BorderLayout.CENTER);

        jPanel65.add(jPanel66, java.awt.BorderLayout.CENTER);

        jPanel_annotation_details.add(jPanel65, java.awt.BorderLayout.CENTER);

        jPanel41.add(jPanel_annotation_details);

        jPanel40.add(jPanel41, java.awt.BorderLayout.CENTER);

        jPanel9.add(jPanel40, java.awt.BorderLayout.NORTH);

        jSplitPane5.setBackground(new java.awt.Color(237, 237, 237));
        jSplitPane5.setDividerLocation(150);
        jSplitPane5.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        jSplitPane5.setResizeWeight(0.5);

        jPanel48.setBackground(new java.awt.Color(237, 237, 237));
        jPanel48.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(240, 240, 240), 2));
        jPanel48.setMinimumSize(new java.awt.Dimension(1, 1));
        jPanel48.setPreferredSize(new java.awt.Dimension(439, 200));
        jPanel48.setLayout(new java.awt.GridLayout(2, 0, 0, 2));

        jPanel70.setLayout(new java.awt.BorderLayout());

        jPanel61.setBackground(new java.awt.Color(237, 237, 237));
        jPanel61.setLayout(new java.awt.BorderLayout());

        jLabel39.setBackground(new java.awt.Color(236, 233, 216));
        jLabel39.setFont(new java.awt.Font("Calibri", 0, 11));
        jLabel39.setForeground(new java.awt.Color(153, 153, 153));
        jLabel39.setText("Relationships:");
        jLabel39.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jLabel39.setFocusable(false);
        jLabel39.setMaximumSize(new java.awt.Dimension(0, 25));
        jLabel39.setMinimumSize(new java.awt.Dimension(0, 25));
        jLabel39.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel61.add(jLabel39, java.awt.BorderLayout.CENTER);

        jPanel18.setBackground(new java.awt.Color(238, 238, 239));
        jPanel18.setLayout(new java.awt.GridLayout(1, 2, 1, 0));

        jButton9.setFont(new java.awt.Font("Calibri", 0, 11));
        jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/3.png"))); // NOI18N
        jButton9.setToolTipText("Enable relationship building");
        jButton9.setBorder(null);
        jButton9.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/res/pressedHammer.png"))); // NOI18N
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });
        jPanel18.add(jButton9);

        edit_Relationships.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/editcut.png"))); // NOI18N
        edit_Relationships.setToolTipText("Edit selected relationship");
        edit_Relationships.setFocusable(false);
        edit_Relationships.setMaximumSize(new java.awt.Dimension(23, 23));
        edit_Relationships.setMinimumSize(new java.awt.Dimension(23, 23));
        edit_Relationships.setPreferredSize(new java.awt.Dimension(23, 23));
        edit_Relationships.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                edit_RelationshipsActionPerformed(evt);
            }
        });
        jPanel18.add(edit_Relationships);

        delete_Relationships.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/closetab.png"))); // NOI18N
        delete_Relationships.setToolTipText("Delete selected relationship");
        delete_Relationships.setMaximumSize(new java.awt.Dimension(23, 23));
        delete_Relationships.setMinimumSize(new java.awt.Dimension(23, 23));
        delete_Relationships.setPreferredSize(new java.awt.Dimension(23, 23));
        delete_Relationships.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                delete_RelationshipsActionPerformed(evt);
            }
        });
        jPanel18.add(delete_Relationships);

        jPanel61.add(jPanel18, java.awt.BorderLayout.EAST);

        jPanel70.add(jPanel61, java.awt.BorderLayout.NORTH);

        jScrollPane8.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane8.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jList_complexrelationships.setFont(new java.awt.Font("Calibri", 0, 11));
        jList_complexrelationships.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jList_complexrelationshipsMouseClicked(evt);
            }
        });
        jList_complexrelationships.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jList_complexrelationshipsValueChanged(evt);
            }
        });
        jScrollPane8.setViewportView(jList_complexrelationships);

        jPanel70.add(jScrollPane8, java.awt.BorderLayout.CENTER);

        jPanel48.add(jPanel70);

        jPanel71.setLayout(new java.awt.BorderLayout());

        jScrollPane9.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane9.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jList_normalrelationship.setFont(new java.awt.Font("Calibri", 0, 11));
        jScrollPane9.setViewportView(jList_normalrelationship);

        jPanel71.add(jScrollPane9, java.awt.BorderLayout.CENTER);

        jPanel63.setBackground(new java.awt.Color(237, 237, 237));
        jPanel63.setLayout(new java.awt.BorderLayout());

        jButton_relationships1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/instancewatch.png"))); // NOI18N
        jButton_relationships1.setFocusable(false);
        jButton_relationships1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton_relationships1.setMargin(new java.awt.Insets(2, 2, 2, 2));
        jButton_relationships1.setPreferredSize(new java.awt.Dimension(20, 20));
        jButton_relationships1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_relationships1ActionPerformed(evt);
            }
        });
        jPanel63.add(jButton_relationships1, java.awt.BorderLayout.EAST);

        jLabel40.setBackground(new java.awt.Color(236, 233, 216));
        jLabel40.setFont(new java.awt.Font("Calibri", 0, 11));
        jLabel40.setForeground(new java.awt.Color(153, 153, 153));
        jLabel40.setText("Attributes:");
        jLabel40.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jLabel40.setFocusable(false);
        jLabel40.setMinimumSize(new java.awt.Dimension(0, 25));
        jLabel40.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel63.add(jLabel40, java.awt.BorderLayout.CENTER);

        jPanel71.add(jPanel63, java.awt.BorderLayout.NORTH);

        jPanel48.add(jPanel71);

        jSplitPane5.setLeftComponent(jPanel48);

        jPanel75.setLayout(new java.awt.BorderLayout());

        jPanel76.setBackground(new java.awt.Color(237, 237, 237));
        jPanel76.setLayout(new java.awt.GridLayout(2, 2, 2, 2));

        jLabel37.setBackground(new java.awt.Color(236, 233, 216));
        jLabel37.setFont(new java.awt.Font("Calibri", 0, 11));
        jLabel37.setForeground(new java.awt.Color(153, 153, 153));
        jLabel37.setText("Creation Date");
        jLabel37.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jLabel37.setMaximumSize(new java.awt.Dimension(0, 16));
        jLabel37.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel76.add(jLabel37);

        jLabel33.setBackground(new java.awt.Color(236, 233, 216));
        jLabel33.setFont(new java.awt.Font("Calibri", 0, 11));
        jLabel33.setForeground(new java.awt.Color(153, 153, 153));
        jLabel33.setText("Annotator");
        jLabel33.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jLabel33.setMaximumSize(new java.awt.Dimension(0, 16));
        jLabel33.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel76.add(jLabel33);

        jTextField_creationdate.setFont(new java.awt.Font("Calibri", 0, 11));
        jTextField_creationdate.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        jTextField_creationdate.setMaximumSize(new java.awt.Dimension(0, 16));
        jTextField_creationdate.setMinimumSize(new java.awt.Dimension(0, 0));
        jPanel76.add(jTextField_creationdate);

        jTextField_annotator.setFont(new java.awt.Font("Calibri", 0, 11));
        jTextField_annotator.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        jTextField_annotator.setMaximumSize(new java.awt.Dimension(0, 16));
        jTextField_annotator.setMinimumSize(new java.awt.Dimension(0, 0));
        jTextField_annotator.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextField_annotatorMouseClicked(evt);
            }
        });
        jTextField_annotator.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jTextField_annotatorFocusLost(evt);
            }
        });
        jPanel76.add(jTextField_annotator);

        jPanel75.add(jPanel76, java.awt.BorderLayout.NORTH);

        jPanel87.setLayout(new java.awt.BorderLayout());

        jPanel84.setLayout(new java.awt.GridLayout(1, 2, 2, 0));

        jPanel68.setBackground(new java.awt.Color(237, 237, 237));
        jPanel68.setMinimumSize(new java.awt.Dimension(1, 1));
        jPanel68.setLayout(new java.awt.BorderLayout());

        jTabbedPane1.setBackground(new java.awt.Color(236, 233, 216));
        jTabbedPane1.setFont(new java.awt.Font("Calibri", 0, 11));
        jTabbedPane1.setMaximumSize(new java.awt.Dimension(32767, 320));
        jTabbedPane1.setMinimumSize(new java.awt.Dimension(1, 1));

        jPanel6.setLayout(new java.awt.BorderLayout());

        suggestions.setFont(new java.awt.Font("Calibri", 0, 11));
        suggestions.setMaximumSize(new java.awt.Dimension(1, 1));
        suggestions.setMinimumSize(new java.awt.Dimension(1, 1));
        suggestions.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                suggestionsValueChanged(evt);
            }
        });
        jScrollPane6.setViewportView(suggestions);

        jPanel6.add(jScrollPane6, java.awt.BorderLayout.CENTER);

        jTabbedPane1.addTab("Suggestions", jPanel6);

        jPanel27.setLayout(new java.awt.BorderLayout());

        jTextPane_explanations.setEditable(false);
        jTextPane_explanations.setMinimumSize(new java.awt.Dimension(1, 1));
        jScrollPane7.setViewportView(jTextPane_explanations);

        jPanel27.add(jScrollPane7, java.awt.BorderLayout.CENTER);

        jTabbedPane1.addTab("Rule Explanations", jPanel27);

        jPanel68.add(jTabbedPane1, java.awt.BorderLayout.CENTER);

        jPanel_colorfulTextBar_filebrowser4.setBackground(new java.awt.Color(41, 119, 167));
        jPanel_colorfulTextBar_filebrowser4.setLayout(new java.awt.BorderLayout());
        jPanel68.add(jPanel_colorfulTextBar_filebrowser4, java.awt.BorderLayout.NORTH);

        jPanel69.setBackground(new java.awt.Color(237, 237, 237));
        jPanel69.setMinimumSize(new java.awt.Dimension(1, 1));
        jPanel69.setLayout(new java.awt.GridLayout(1, 0, 4, 4));

        jButton12.setFont(new java.awt.Font("Calibri", 0, 11));
        jButton12.setText("Set Annotation To Selected");
        jButton12.setToolTipText("<html>Modify the selected annotation to match<br> the currently selected suggestion</html>");
        jButton12.setEnabled(false);
        jButton12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton12ActionPerformed(evt);
            }
        });
        jPanel69.add(jButton12);

        jPanel68.add(jPanel69, java.awt.BorderLayout.SOUTH);

        jPanel84.add(jPanel68);

        jPanel72.setBackground(new java.awt.Color(237, 237, 237));
        jPanel72.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(240, 240, 240), 2));
        jPanel72.setMinimumSize(new java.awt.Dimension(1, 1));
        jPanel72.setLayout(new java.awt.BorderLayout());

        jLabel41.setBackground(new java.awt.Color(236, 233, 216));
        jLabel41.setFont(new java.awt.Font("Calibri", 0, 11));
        jLabel41.setForeground(new java.awt.Color(153, 153, 153));
        jLabel41.setText("Saved Verify Suggestion:");
        jLabel41.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jLabel41.setMaximumSize(new java.awt.Dimension(0, 25));
        jLabel41.setMinimumSize(new java.awt.Dimension(0, 25));
        jLabel41.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel72.add(jLabel41, java.awt.BorderLayout.NORTH);

        jScrollPane10.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane10.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        jList3.setFont(new java.awt.Font("Calibri", 0, 11));
        jScrollPane10.setViewportView(jList3);

        jPanel72.add(jScrollPane10, java.awt.BorderLayout.CENTER);

        jPanel84.add(jPanel72);

        jPanel87.add(jPanel84, java.awt.BorderLayout.CENTER);

        jPanel_colorfulTextBar_filebrowser7.setBackground(new java.awt.Color(41, 119, 167));
        jPanel_colorfulTextBar_filebrowser7.setLayout(new java.awt.BorderLayout());

        jLabel42.setBackground(new java.awt.Color(41, 119, 167));
        jLabel42.setFont(new java.awt.Font("Calibri", 1, 13));
        jLabel42.setForeground(new java.awt.Color(255, 255, 255));
        jLabel42.setText("  VERIFIER");
        jLabel42.setMaximumSize(new java.awt.Dimension(5000, 19));
        jLabel42.setMinimumSize(new java.awt.Dimension(1, 1));
        jLabel42.setPreferredSize(new java.awt.Dimension(200, 19));
        jLabel42.setRequestFocusEnabled(false);
        jLabel42.setVerifyInputWhenFocusTarget(false);
        jPanel_colorfulTextBar_filebrowser7.add(jLabel42, java.awt.BorderLayout.CENTER);

        jPanel87.add(jPanel_colorfulTextBar_filebrowser7, java.awt.BorderLayout.NORTH);

        jPanel75.add(jPanel87, java.awt.BorderLayout.CENTER);

        jSplitPane5.setRightComponent(jPanel75);

        jPanel9.add(jSplitPane5, java.awt.BorderLayout.CENTER);

        jPanel49.add(jPanel9, java.awt.BorderLayout.CENTER);

        jSplitPane_Annotations_Comparator.setLeftComponent(jPanel49);

        jPanel_comparator_container.setBackground(new java.awt.Color(237, 237, 237));
        jPanel_comparator_container.setLayout(new java.awt.BorderLayout());
        jSplitPane_Annotations_Comparator.setRightComponent(jPanel_comparator_container);

        jSplitPane_between_viewer_and_allatttibutes.setRightComponent(jSplitPane_Annotations_Comparator);

        jCardcontainer_interactive.add(jSplitPane_between_viewer_and_allatttibutes, "card2");

        jPanel_NLP.setBackground(new java.awt.Color(237, 237, 237));
        jPanel_NLP.setForeground(new java.awt.Color(215, 211, 210));
        jPanel_NLP.setLayout(new java.awt.BorderLayout());
        jCardcontainer_interactive.add(jPanel_NLP, "card2");

        Editor.add(jCardcontainer_interactive, java.awt.BorderLayout.CENTER);

        GUIContainer.add(Editor, "card6");

        jPanel_textPane.setBackground(new java.awt.Color(237, 237, 237));
        jPanel_textPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(200, 200, 200), 3));
        jPanel_textPane.setLayout(new java.awt.BorderLayout());
        GUIContainer.add(jPanel_textPane, "card3");

        JPanel_PinsExtractor.setBackground(new java.awt.Color(237, 237, 237));

        org.jdesktop.layout.GroupLayout JPanel_PinsExtractorLayout = new org.jdesktop.layout.GroupLayout(JPanel_PinsExtractor);
        JPanel_PinsExtractor.setLayout(JPanel_PinsExtractorLayout);
        JPanel_PinsExtractorLayout.setHorizontalGroup(
            JPanel_PinsExtractorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1197, Short.MAX_VALUE)
        );
        JPanel_PinsExtractorLayout.setVerticalGroup(
            JPanel_PinsExtractorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 645, Short.MAX_VALUE)
        );

        GUIContainer.add(JPanel_PinsExtractor, "card5");

        jPanel_Converter.setBackground(new java.awt.Color(237, 237, 237));

        org.jdesktop.layout.GroupLayout jPanel_ConverterLayout = new org.jdesktop.layout.GroupLayout(jPanel_Converter);
        jPanel_Converter.setLayout(jPanel_ConverterLayout);
        jPanel_ConverterLayout.setHorizontalGroup(
            jPanel_ConverterLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1197, Short.MAX_VALUE)
        );
        jPanel_ConverterLayout.setVerticalGroup(
            jPanel_ConverterLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 645, Short.MAX_VALUE)
        );

        GUIContainer.add(jPanel_Converter, "card6");

        getContentPane().add(GUIContainer, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    //<editor-fold defaultstate="collapsed" desc="Generated Events - 1">
    /**Show dialogs of file chooser and add selected files into memory,<br>
     * then refresh the table of inputed file list.<br>
     */
    private void jButton_AddClinicalTextsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AddClinicalTextsActionPerformed

        //#### select new txt file
        JFileChooser fc = new JFileChooser();
        fc.setDialogType(JFileChooser.OPEN_DIALOG);
        fc.setMultiSelectionEnabled(true);
        String[] type = {"txt", "TXT", "Txt"};
        fc.setFileFilter( new commons.SimpleFileFilter(type, "text files") );
        fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
        // show the dialog to let user select txt file
        int flag = fc.showDialog(this, "Select Text Files");

        // if user selected some text files
        if(flag==JFileChooser.APPROVE_OPTION){

            File[] selectedfiles = fc.getSelectedFiles();

            if(selectedfiles==null)
                return;

            // raise new dialog to copy these text files to current project
            if(selectedfiles.length>0){
                CorpusImport.Copying cp = new CorpusImport.Copying(this, 
                        selectedfiles, env.Parameters.WorkSpace.CurrentProject);
                cp.setVisible(true);
            }
        }


        
        
        /*int listsize = jComboBox_InputFileList.getModel().getSize();
        // show file dialog to select clinical notes
        // select file, not directory
        setFileChooserAttributes(fileInputType.selectClinicalTextFiles);
        
        // show dialog 
        jFileChooser1.showOpenDialog(this);

        // get results from file chooser
        File[] files = jFileChooser1.getSelectedFiles();

        // if choosed file(s), check the files
        // and load their info into the memory and show in table
        int loops = files.length;
        
        // load selected textsourceFilename into memory and set into env, then write
        // into configure file
        for (int i = 0; i < loops; i++) {
            this.addTextFile( files[i] );
        }

        // save potential changes in configuration file
        env.Configure.updateAll();

        // show total amount of clinical notes
        

        this.showTextFiles();
        


        // add file names to the vector
        showTextFiles_inComboBox();

        if( listsize < 1 ){
            enterTab_ResultEditor();
        }
         
         */
        
    }//GEN-LAST:event_jButton_AddClinicalTextsActionPerformed


    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your process code here:

        int size = jList_corpus.getModel().getSize();

        boolean isCurrentDocumentGotDeleted = false;
        // if row i has beed selected in the table, delete matched records in these arraylist
        int i = size - 1;
        File currentfile = ResultEditor.WorkSpace.WorkSet.getCurrentFile();

        while (i >= 0)
        {
            if (jList_corpus.isSelectedIndex(i))
            {
                File f = env.Parameters.LIST_ClinicalNotes.get(i).file;

                if (( f != null)||(currentfile != null)){
                    if (f.equals( currentfile ))
                    {
                        
                        isCurrentDocumentGotDeleted = true;
                    }
                }
                f.delete();

                env.Parameters.LIST_ClinicalNotes.remove(i);

            }            
            i--;
        }

        this.refreshFileList();

        if( isCurrentDocumentGotDeleted )
            enterTab_ResultEditor();

        config.system.SysConf.saveSystemConfigure();

        
        //cleanAndReload_ListOfFileCollection();

        // save changes in configuration file
        

       
            int sizew = env.ClinicalNoteList.CorpusLib.getSize();
            jComboBox_InputFileList.removeAllItems();
            // show inputted file into the combobox
            for (int qi = 0; qi < sizew; qi++) {
                jComboBox_InputFileList.addItem(env.ClinicalNoteList.CorpusLib.getFileName(qi));
            }
       


    }//GEN-LAST:event_jButton2ActionPerformed
    // insert text into textpanel with assigned color
    /*public void insertDocument(String _text, Color _textColor,
            int _fontSize, javax.swing.JTextPane _textPanel) {
        
        if (_text == null)  return;
        if (_text.length() < 1) return;
       
        if (_textColor == null)     _textColor = Color.black;
        if (_fontSize <= 1) _fontSize = 12;
        
        try {
            SimpleAttributeSet set = new SimpleAttributeSet();
            StyleConstants.setForeground(set, _textColor);
            StyleConstants.setFontSize(set, _fontSize);
            Document doc = _textPanel.getStyledDocument();

            doc.insertString(doc.getLength(), _text, set);
        } catch (Exception e) {
        }
    }*/

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed

        Flag_Want_Shutdown_Program = false;
        confirmExit.dispose();
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed

        Flag_Want_Shutdown_Program = true;
        confirmExit.dispose();
}//GEN-LAST:event_jButton7ActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        
        // save global setting for eHOST
        config.system.SysConf.saveSystemConfigure();
        // save setting for current project
        config_saveProjectSetting();
    }//GEN-LAST:event_formWindowClosing
  

    private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
        // ##1##
        // exit from annotation comparison mode if editor panel and comparator
        // panel are showed for comparing annotation conflits
        try{
            ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).setStatusInvisiable();
        }catch(Exception ex){
            System.out.println("error 1012011313:: fail to leave annotations compaison mode!!!");
        }
        
        resetVerifier();
        goBack_ChoicedFile();
        disableAnnotationDisplay();
        if(jTabbedPane3.getSelectedIndex() != 0)
            jTabbedPane3.getSelectedComponent().repaint();
    }//GEN-LAST:event_jButton13ActionPerformed

    private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
        
        // ##1##
        // exit from annotation comparison mode if editor panel and comparator
        // panel are showed for comparing annotation conflits
        try{
            ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).setStatusInvisiable();
        }catch(Exception ex){
            System.out.println("error 1012011313:: fail to leave annotations compaison mode!!!");
        }

        resetVerifier();
        gotoNextChoicedFile();
        disableAnnotationDisplay();
        if(jTabbedPane3.getSelectedIndex() != 0)
            jTabbedPane3.getSelectedComponent().repaint();
    }//GEN-LAST:event_jButton14ActionPerformed

    private void jComboBox_InputFileListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_InputFileListActionPerformed
        // by the user disignated textsourceFilename, show its text contents in text
        // area
        goUserDesignated();
        if(jTabbedPane3.getSelectedIndex() != 0)
            jTabbedPane3.getSelectedComponent().repaint();
    }//GEN-LAST:event_jComboBox_InputFileListActionPerformed

    private void jTextField_searchtextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_searchtextActionPerformed
        // TODO add your process code here:
    }//GEN-LAST:event_jTextField_searchtextActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        searchWord();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jList_selectedAnnotationsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList_selectedAnnotationsValueChanged
        // ##1## if is in mode of annotation comparing, this function will be disabled
        if(((UserInterface.AnnotationCompare.ExpandButton)jPanel60).isComparatorPanelExpanded()){
            return;
        }

        // ####
        int selected = jList_selectedAnnotations.getSelectedIndex();
        if (selected < 0) return;
                
        env.Parameters.latestSelectedInListOfMultipleAnnotions = selected;

        showDetailsByIndex(selected);// TODO add your process code here:
    }//GEN-LAST:event_jList_selectedAnnotationsValueChanged

    
    private void jToggleButton_CreateAnnotaionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton_CreateAnnotaionActionPerformed

        //GUI: enter tab of creation annotaion
        tabDoorman(TabGuard.tabs.creationAnnotation);

    }//GEN-LAST:event_jToggleButton_CreateAnnotaionActionPerformed

    private void jToggleButton_ResultEditorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton_ResultEditorActionPerformed

        //GUI: enter tab of result editor
        tabDoorman(TabGuard.tabs.resulteditor);
    }//GEN-LAST:event_jToggleButton_ResultEditorActionPerformed

    /**button clicked: show dictionaries setting dialog*/
    private void jToggleButton_DictionarySettingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton_DictionarySettingActionPerformed
        // show dictionaries setting dialog
        FLAG_MAYBE_CHANGED = true;
        tabDoorman( TabGuard.tabs.dictionariesSetting);
    }//GEN-LAST:event_jToggleButton_DictionarySettingActionPerformed

    /**Show dialog to confirm exiting or not after user just has
     * clicked exit button on menu bar.*/
    /**user clicked button to active tab of pin extractor*/
    private void jToggleButton_PinExtractorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton_PinExtractorActionPerformed
        tabDoorman(TabGuard.tabs.pinExtractor);
    }//GEN-LAST:event_jToggleButton_PinExtractorActionPerformed

    /**GUI: enter tab of dictionary manager*/
    private void jToggleButton_DictionaryManagerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton_DictionaryManagerActionPerformed
        tabDoorman( TabGuard.tabs.dictionariesManager );
    }//GEN-LAST:event_jToggleButton_DictionaryManagerActionPerformed

    private void jToggleButton_exitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton_exitActionPerformed
        tabDoorman( TabGuard.tabs.exit );
    }//GEN-LAST:event_jToggleButton_exitActionPerformed

    private void jButton_spaneditor_deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_spaneditor_deleteActionPerformed
        spanEdit(spanedittype.delete);
    }//GEN-LAST:event_jButton_spaneditor_deleteActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your process code here:
        spanEdit(spanedittype.headExtendtoLeft);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your process code here:
        spanEdit(spanedittype.tailExtendtoRight);
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        spanEdit(spanedittype.headShortentoRight);
    }//GEN-LAST:event_jButton10ActionPerformed

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
        spanEdit(spanedittype.tailshortentoLeft);
    }//GEN-LAST:event_jButton11ActionPerformed

    private void jTextField_searchtextKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField_searchtextKeyTyped

        // search word if key "enter" pressed
        int key = Integer.valueOf( evt.getKeyChar() );
        if ( key == 10 ) {
            searchWord();
        }

        // 'esc' key got pressed
        if( key == 27 ){
            jTextField_searchtext.setText("");
        }
    }//GEN-LAST:event_jTextField_searchtextKeyTyped

    /**User click button to import annotations from xml or pin files.*/
    private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton18ActionPerformed
        ImportSettings settings = new ImportSettings(this);
        settings.setVisible(true);
        /*
        // import annotations from XML or PINS file
        // and then show on screen(in result ediot)
        //importAnnotations();
        

        // clear all attributes value display and disable those buttons as
        // no annotation are selected just after annotations been imported.
        disableAnnotationDisplay();

        // as we just have extracted and stored annotated classname while
        // importing annotation from xml knowtator files, we should write new
        // found annotated class name into disk.
        ResultEditor.AnnotationClasses.Depot classdepot = new ResultEditor.AnnotationClasses.Depot();
        classdepot.saveAnnotationClassnamesToConfigureFile();


        // show all classes in the tree view
        this.showAnnotationCategoriesInTreeView_CurrentArticle();
        this.showValidPositionIndicators_setAll();
        this.showValidPositionIndicators();

        setNAVCurrentTab(3);
        /*
        //Run Verifier on input
        //Make sure verifier dictionaries are loaded.
        Dictionaries.VerifierDictionaries.loadPreAnnotatedConcepts();
        for(int i = 0; i< jComboBox_InputFileList.getItemCount(); i++ )
        {
            Verifier.SpanCheck spanCheck = new Verifier.SpanCheck(
                    env.ClinicalNoteList.SelectedTxtFile.getAbsoluteFileName(i), env.Parameters.VERIFIER_DICTIONARIES);
            spanCheck.findProblems(-1);
        }
         * 
         */

        //currentScreen = infoScreens.NONE;
        //refreshInfo();

        
 
    }//GEN-LAST:event_jButton18ActionPerformed

    /**remove all imported annotations and refresh the display of text contents
     * of processing clinical notes*/
    private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton19ActionPerformed
        // remove all imported annotations
        // remove all annotation display and refresh
        cleanImportedXMLBufferAndReload();

        totalRefresh();
    }//GEN-LAST:event_jButton19ActionPerformed

    private void jButton12ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton12ActionPerformed
    {//GEN-HEADEREND:event_jButton12ActionPerformed
        //Extract the indices of problem annotations
        //callVerifierWithCurrent();

        //Display problem annotations to annotations... might not want to add these directly to our memory
        //model. Probably better to just save them separately and append them to the end of the written
        //XML file.
        //addProblemAnnotations();
        changeSelectedToSuggestion();
        
        //TODO: Write new/old annotations to file that can be used in knowtator
        
    }//GEN-LAST:event_jButton12ActionPerformed

    private void suggestionsValueChanged(javax.swing.event.ListSelectionEvent evt)//GEN-FIRST:event_suggestionsValueChanged
    {//GEN-HEADEREND:event_suggestionsValueChanged
        if(suggestions.getSelectedIndex() != -1)
            jButton12.setEnabled(true);
        else
            jButton12.setEnabled(false);
            
    }//GEN-LAST:event_suggestionsValueChanged

    private void jButton_SelectClassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_SelectClassActionPerformed
        /**while user click the icon of change annotation class on result editor.<p>
         * 1. show available annotation classnames for user to select while this label
         *    is enabled.<p>
         * 2. do nothing if this lable is disabled.<p>
         */
        ResultEditor.WorkSpace.WorkSet.latestScrollBarValue = jScrollPane_textpane.getVerticalScrollBar().getValue();
        if(jButton_SelectClass.isEnabled()){
            ResultEditor.SpanEdit.AnnotationClassChooser popmenu =
                new ResultEditor.SpanEdit.AnnotationClassChooser(
                    jTextField_annotationClassnames,
                    this,
                    jTextField_annotationClassnames.getText().trim()
                );
            popmenu.popupDialog( ResultEditor.WorkSpace.WorkSet.currentAnnotation.annotationText );
        }else{
            // beep if lable got disabled
            commons.Tools.beep();
        }
    }//GEN-LAST:event_jButton_SelectClassActionPerformed

    
    /**user click button on result editor to save changes to xml or pins files*/
    private void jButton20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton20ActionPerformed
        saveChanges();
    }//GEN-LAST:event_jButton20ActionPerformed

    private void jButton23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton23ActionPerformed
        if( classmanager == null || !classmanager.isActive()) {
            classmanager = new ResultEditor.AnnotationClasses.Manager(this);
            classmanager.setVisible(true);
        }
    }//GEN-LAST:event_jButton23ActionPerformed

    private void jButton_relationships1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_relationships1ActionPerformed
        openAttributeEditor();

    }//GEN-LAST:event_jButton_relationships1ActionPerformed

    private void jTabbedPane3MouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_jTabbedPane3MouseClicked
    {//GEN-HEADEREND:event_jTabbedPane3MouseClicked
        showValidPositionIndicators();
    }//GEN-LAST:event_jTabbedPane3MouseClicked

    private void classesMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_classesMouseClicked
    {//GEN-HEADEREND:event_classesMouseClicked
        setToClasses();
}//GEN-LAST:event_classesMouseClicked
    

    private void classesMouseEntered(java.awt.event.MouseEvent evt)//GEN-FIRST:event_classesMouseEntered
    {//GEN-HEADEREND:event_classesMouseEntered
        classes.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}//GEN-LAST:event_classesMouseEntered

    private void annotationsMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_annotationsMouseClicked
    {//GEN-HEADEREND:event_annotationsMouseClicked
        setToAnnotations();
    }//GEN-LAST:event_annotationsMouseClicked

    private void annotatorsMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_annotatorsMouseClicked
    {//GEN-HEADEREND:event_annotatorsMouseClicked
        setToAnnotators();
}//GEN-LAST:event_annotatorsMouseClicked


    /**
     *
     * This will catch any events where a mouse is clicked on the infoList.
     * If left double click then the selction will be expanded if possible.
     * If right click in 'Conflicts' view then a pop up menu will come up to allow
     * you to resolve conflicts.
     *
     * @param evt - the mouse event
     */
    private void infoListMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_infoListMouseClicked
    {//GEN-HEADEREND:event_infoListMouseClicked
        //If right click then do something... based on current screen.
        if(evt.getButton()== MouseEvent.BUTTON3)
        {
            switch(currentScreen)
            {
                //If we're dealing with ClassConflicts then allow the user to 'resolve' the conflict by
                //selecting the appropriate class with a PopUp menu.
                case CLASSCONFLICT:
                    ResultEditor.Conflicts.classConflictPopUp popmenu = new ResultEditor.Conflicts.classConflictPopUp(
                    this.infoList, this);
                    popmenu.pop(evt.getX(), evt.getY());
                    break;
                case ANNOTATIONS:
                case VERIFIER:
                    ResultEditor.PopUp.rightClickOnAnnotPopUp annotPopUp = new ResultEditor.PopUp.rightClickOnAnnotPopUp(
                    this.infoList, this);
                    annotPopUp.pop((Annotation)infoList.getSelectedValue(),evt.getX(), evt.getY());
                    break;
            }
        }
        //If double clicked then move into the entry if possible.
        if(evt.getClickCount() == 2 && evt.getButton() == MouseEvent.BUTTON1)
        {

            switch(currentScreen)
            {
                //If A Class has been selected then show all Annotations with that class
                case CLASSES: 
                    String selectedClass = (String)infoList.getSelectedValue();
                    selectAClass(selectedClass);
                    currentScreen = infoScreens.ANNOTATIONS;
                    break;
                //If An annotator has been selected then show all Annotations with that Annotator
                case ANNOTATORS: 
                    selectAnAnnotator();
                    currentScreen = infoScreens.ANNOTATIONS;
                    break;
                //If A span conflict has been selected then show all Annotations involved in that span conflict.
                case SPANCONFLICT:
                    spanOverlaps toShow = (spanOverlaps)infoList.getSelectedValue();
                    infoList.setListData(toShow.getInvolved());
                    currentScreen = infoScreens.ANNOTATIONS;
                    break;
                
            }
        }
    }//GEN-LAST:event_infoListMouseClicked

    /*
     * Called when display current list in viewer button is pressed.  This method will
     * display whatever is in the current list, if it is a list of annotations.
     */
    private void displayCurrentActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_displayCurrentActionPerformed
    {//GEN-HEADEREND:event_displayCurrentActionPerformed
        //Make sure we're viewing a list of annotations... either from the Verifier or just
        // annotations
        if (currentScreen == infoScreens.ANNOTATIONS || currentScreen == infoScreens.VERIFIER)
        {
            //Get all of the Annotations in the list
            int entries = infoList.getModel().getSize();

            //if there are no entries then return.
            if (entries == 0)
            {
                return;
            }
            //If the first object is not an annotation then return.
            if (!infoList.getModel().getElementAt(0).getClass().isInstance(new Annotation()))
            {
                return;
            }
            //to store results
            Vector<Annotation> currentlyViewing = new Vector<Annotation>();

            //get the list of annotations so we can display them.
            for (int i = 0; i < entries; i++)
            {
                currentlyViewing.add((Annotation) infoList.getModel().getElementAt(i));
            }

            //Draw the selected annotations(highlights)
            repaintNewAnnotations(currentlyViewing);
        }
        //If we're viewing class conflicts then display all annotations involved.
        else if (currentScreen == infoScreens.CLASSCONFLICT)
        {
            //Get the number of class conflicts
            int entries = infoList.getModel().getSize();

            //Return if there are no entries.
            if (entries == 0)
            {
                return;
            }
            //return if the first element is not a class conflict
            if (!infoList.getModel().getElementAt(0).getClass().isInstance(new classConflict()))
            {
                return;
            }
            //Get the curently viewed class conflicts.
            Vector<classConflict> currentlyViewing = new Vector<classConflict>();
            for (int i = 0; i < entries; i++)
            {
                currentlyViewing.add((classConflict) infoList.getModel().getElementAt(i));
            }

            //Get the annotations from each class conflict.
            Vector<Annotation> annotations = new Vector<Annotation>();
            for(classConflict conflict: currentlyViewing)
            {
                annotations.addAll(conflict.getInvolved());
            }
            //Redraw the highlighting
            repaintNewAnnotations(annotations);
        }
        //Display all annotations in a span conflict.
        else if (currentScreen == infoScreens.SPANCONFLICT)
        {
            int entries = infoList.getModel().getSize();
            //return if there are no entries
            if (entries == 0)
            {
                return;
            }
            //return if it's not a list of span overlaps
            if (!infoList.getModel().getElementAt(0).getClass().isInstance(new spanOverlaps()))
            {
                return;
            }
            //get the span overlaps
            Vector<spanOverlaps> currentlyViewing = new Vector<spanOverlaps>();
            for (int i = 0; i < entries; i++)
            {
                currentlyViewing.add((spanOverlaps) infoList.getModel().getElementAt(i));
            }
            //get the annotations
            Vector<Annotation> annotations = new Vector<Annotation>();
            for(spanOverlaps conflict: currentlyViewing)
            {
                annotations.addAll(conflict.getInvolved());
            }
            //redraw the annotations
            repaintNewAnnotations(annotations);
        }
    }//GEN-LAST:event_displayCurrentActionPerformed
    
    private void workingConflictsMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_workingConflictsMouseClicked
    {//GEN-HEADEREND:event_workingConflictsMouseClicked
        setToClassConflict();
    }//GEN-LAST:event_workingConflictsMouseClicked

    private void jTree_classMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree_classMousePressed

        // user just made a single click on the treeview of classes and annotations
        ResultEditor.WorkSpace.WorkSet.mouse_clicked_on = 1;
        userMouseClicked_onClassTreeView(evt);
    }//GEN-LAST:event_jTree_classMousePressed

    private void jTree_classTreeCollapsed(javax.swing.event.TreeExpansionEvent evt) {//GEN-FIRST:event_jTree_classTreeCollapsed
        ResultEditor.AnnotationClasses.Mouse.CollapsedListener collapsedlistener =
                new ResultEditor.AnnotationClasses.Mouse.CollapsedListener( evt, jTree_class );
    }//GEN-LAST:event_jTree_classTreeCollapsed

    private void textPaneforClinicalNotesMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_textPaneforClinicalNotesMouseReleased
        ResultEditor.WorkSpace.WorkSet.mouse_clicked_on = 2;
        mouseClickOnTextPane( evt );
    }//GEN-LAST:event_textPaneforClinicalNotesMouseReleased

    private void jTextField_spanLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_spanLocationActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField_spanLocationActionPerformed

    private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed
        smallerFontSize();
    }//GEN-LAST:event_jButton21ActionPerformed

    private void jButton22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton22ActionPerformed
        biggerFontSize();
    }//GEN-LAST:event_jButton22ActionPerformed

    private void verifierFlaggedMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_verifierFlaggedMouseClicked
    {//GEN-HEADEREND:event_verifierFlaggedMouseClicked
        setToVerifier();
    }//GEN-LAST:event_verifierFlaggedMouseClicked
    
    private void verifierOnCurrentActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_verifierOnCurrentActionPerformed
    {//GEN-HEADEREND:event_verifierOnCurrentActionPerformed
        this.callVerifierWithCurrent();
        currentScreen = infoScreens.VERIFIER;
        refreshInfo();
    }//GEN-LAST:event_verifierOnCurrentActionPerformed

    private void infoListValueChanged(javax.swing.event.ListSelectionEvent evt)//GEN-FIRST:event_infoListValueChanged
    {//GEN-HEADEREND:event_infoListValueChanged
        switch (currentScreen)
            {

                case ANNOTATIONS:
                case VERIFIER:
                    if(infoList.getSelectedIndex() >= 0)
                    {
                        this.jTabbedPane3.setSelectedIndex(0);
                        displayInfoForAnnotation(infoList.getSelectedValues());
                        Depot depot = new Depot();
                        infoList.setToolTipText(depot.getContext((Annotation)infoList.getSelectedValue()));
                    }
                    break;
            }

    }//GEN-LAST:event_infoListValueChanged
       

    /**ONLY used for method "setNAVonFirstOrSecondPage()"*/
    private int ActivedNVATAB=-1;
    public void setNAVonFirstOrSecondPage()
    {
        if(this.jPanel_NAV_Card2.isVisible())
        {
            return;
        }

        if(this.jPanel_NAV_Card3.isVisible()){
            if( ActivedNVATAB == 1)
                this.setNAVCurrentTab( 1 );
            else if(ActivedNVATAB == 2)
                this.setNAVCurrentTab( 2 );


        }
    }

    public void setNAVonThirdPage(){
        this.setNAVCurrentTab( 3 );
    }
//</editor-fold>
    
    //<editor-fold defaultstate="collapsed" desc="GUI Component Declaration">
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel BottomInfoBar;
    private javax.swing.JPanel Editor;
    private javax.swing.JPanel GUIContainer;
    private javax.swing.JPanel JPanel_PinsExtractor;
    private javax.swing.JPanel NavigationPanel1;
    private javax.swing.JPanel NavigationPanel_editor;
    private javax.swing.JToolBar ToolBar;
    private javax.swing.JLabel annotations;
    private javax.swing.JLabel annotators;
    private javax.swing.ButtonGroup buttonGroup_MainButton_startAnalysis;
    private javax.swing.ButtonGroup buttonGroup_Tabs;
    private javax.swing.ButtonGroup buttonGroup_quicknlp;
    private javax.swing.ButtonGroup buttonGroup_treeview;
    private javax.swing.JLabel classes;
    private javax.swing.JDialog confirmExit;
    private javax.swing.JButton delete_Relationships;
    private javax.swing.JButton displayCurrent;
    private javax.swing.JButton edit_Relationships;
    private javax.swing.JList infoList;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton15;
    private javax.swing.JButton jButton16;
    private javax.swing.JButton jButton17;
    private javax.swing.JButton jButton18;
    private javax.swing.JButton jButton19;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton20;
    private javax.swing.JButton jButton21;
    private javax.swing.JButton jButton22;
    private javax.swing.JButton jButton23;
    private javax.swing.JButton jButton24;
    private javax.swing.JButton jButton26;
    private javax.swing.JButton jButton27;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JToggleButton jButton9;
    private javax.swing.JButton jButton_AddClinicalTexts;
    private javax.swing.JButton jButton_AddClinicalTexts1;
    private javax.swing.JButton jButton_SelectClass;
    private javax.swing.JButton jButton_relationships1;
    private javax.swing.JButton jButton_removeduplicates;
    private javax.swing.JButton jButton_save;
    private javax.swing.JButton jButton_save1;
    private javax.swing.JButton jButton_spaneditor_delete;
    private javax.swing.JPanel jCardcontainer_interactive;
    private javax.swing.JComboBox jComboBox_InputFileList;
    private javax.swing.JComboBox jComboBox_currentworkspace_abspath;
    private javax.swing.JFileChooser jFileChooser1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabel_cursor;
    private javax.swing.JLabel jLabel_icon_annotationlist;
    private javax.swing.JLabel jLabel_info_annotator;
    private javax.swing.JLabel jLabel_info_annotatorlabel;
    private javax.swing.JLabel jLabel_infobar;
    private javax.swing.JLabel jLabel_infobar_FlagOfDiff;
    private javax.swing.JLabel jLabel_infobar_FlagOfOracle;
    private javax.swing.JLabel jLabel_infobar_FlagOfPath;
    private javax.swing.JLabel jLabel_toolbar_split;
    private javax.swing.JLabel jLabel_toolbar_split1;
    private javax.swing.JList jList3;
    private javax.swing.JList jList_NAV_projects;
    private javax.swing.JList jList_complexrelationships;
    private javax.swing.JList jList_corpus;
    private javax.swing.JList jList_normalrelationship;
    private javax.swing.JList jList_selectedAnnotations;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel36;
    private javax.swing.JPanel jPanel37;
    private javax.swing.JPanel jPanel38;
    private javax.swing.JPanel jPanel39;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel40;
    private javax.swing.JPanel jPanel41;
    private javax.swing.JPanel jPanel42;
    private javax.swing.JPanel jPanel43;
    private javax.swing.JPanel jPanel44;
    private javax.swing.JPanel jPanel45;
    private javax.swing.JPanel jPanel46;
    private javax.swing.JPanel jPanel47;
    private javax.swing.JPanel jPanel48;
    private javax.swing.JPanel jPanel49;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel50;
    private javax.swing.JPanel jPanel55;
    private javax.swing.JPanel jPanel57;
    private javax.swing.JPanel jPanel58;
    private javax.swing.JPanel jPanel59;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel60;
    private javax.swing.JPanel jPanel61;
    private javax.swing.JPanel jPanel63;
    private javax.swing.JPanel jPanel64;
    private javax.swing.JPanel jPanel65;
    private javax.swing.JPanel jPanel66;
    private javax.swing.JPanel jPanel68;
    private javax.swing.JPanel jPanel69;
    private javax.swing.JPanel jPanel70;
    private javax.swing.JPanel jPanel71;
    private javax.swing.JPanel jPanel72;
    private javax.swing.JPanel jPanel73;
    private javax.swing.JPanel jPanel74;
    private javax.swing.JPanel jPanel75;
    private javax.swing.JPanel jPanel76;
    private javax.swing.JPanel jPanel77;
    private javax.swing.JPanel jPanel78;
    private javax.swing.JPanel jPanel79;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel80;
    private javax.swing.JPanel jPanel81;
    private javax.swing.JPanel jPanel82;
    private javax.swing.JPanel jPanel83;
    private javax.swing.JPanel jPanel84;
    private javax.swing.JPanel jPanel86;
    private javax.swing.JPanel jPanel87;
    private javax.swing.JPanel jPanel88;
    private javax.swing.JPanel jPanel8_bottomBar;
    private javax.swing.JPanel jPanel8_bottomBar1;
    private javax.swing.JPanel jPanel8_currentWorkSpace;
    private javax.swing.JPanel jPanel8_topBar;
    private javax.swing.JPanel jPanel8_topBar1;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPanel jPanel90;
    private javax.swing.JPanel jPanel91;
    private javax.swing.JPanel jPanel92;
    private javax.swing.JPanel jPanel94;
    private javax.swing.JPanel jPanel95;
    private javax.swing.JPanel jPanel99;
    private javax.swing.JPanel jPanel_Converter;
    private javax.swing.JPanel jPanel_NAV_Card1;
    private javax.swing.JPanel jPanel_NAV_Card2;
    private javax.swing.JPanel jPanel_NAV_Card3;
    private javax.swing.JPanel jPanel_NAV_CardContainer;
    private javax.swing.JPanel jPanel_NLP;
    private javax.swing.JPanel jPanel_annotation_details;
    private javax.swing.JPanel jPanel_colorfulTextBar_filebrowser2;
    private javax.swing.JPanel jPanel_colorfulTextBar_filebrowser3;
    private javax.swing.JPanel jPanel_colorfulTextBar_filebrowser4;
    private javax.swing.JPanel jPanel_colorfulTextBar_filebrowser6;
    private javax.swing.JPanel jPanel_colorfulTextBar_filebrowser7;
    private javax.swing.JPanel jPanel_comparator_container;
    private javax.swing.JPanel jPanel_corpuslist_innerline;
    private javax.swing.JPanel jPanel_corpuslist_outline;
    private javax.swing.JPanel jPanel_infobar_center;
    private javax.swing.JPanel jPanel_infobar_right_current_annotator;
    private javax.swing.JPanel jPanel_interactive_left;
    private javax.swing.JPanel jPanel_multipleResultShowList;
    private javax.swing.JPanel jPanel_position_indicator_container;
    private javax.swing.JPanel jPanel_reportFormContainer;
    private javax.swing.JPanel jPanel_textPane;
    private javax.swing.JRadioButton jRadioButton_treeview_currentarticle;
    private javax.swing.JRadioButton jRadioButton_treeview_overall;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane12;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JScrollPane jScrollPane_classtree;
    private javax.swing.JScrollPane jScrollPane_textpane;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSplitPane jSplitPane5;
    private javax.swing.JSplitPane jSplitPane_Annotations_Comparator;
    private javax.swing.JSplitPane jSplitPane_between_viewer_and_allatttibutes;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTabbedPane jTabbedPane3;
    private javax.swing.JTextArea jTextArea_comment;
    private javax.swing.JTextField jTextField_annotationClassnames;
    private javax.swing.JTextField jTextField_annotator;
    private javax.swing.JTextField jTextField_creationdate;
    private javax.swing.JTextField jTextField_sample;
    private javax.swing.JTextField jTextField_searchtext;
    private javax.swing.JTextField jTextField_spanLocation;
    private javax.swing.JTextPane jTextPane_explanations;
    private javax.swing.JToggleButton jToggleButton_Converter;
    private javax.swing.JToggleButton jToggleButton_CreateAnnotaion;
    private javax.swing.JToggleButton jToggleButton_DictionaryManager;
    private javax.swing.JToggleButton jToggleButton_DictionaryManager1;
    private javax.swing.JToggleButton jToggleButton_DictionarySetting;
    private javax.swing.JToggleButton jToggleButton_PinExtractor;
    private javax.swing.JToggleButton jToggleButton_ResultEditor;
    private javax.swing.JToggleButton jToggleButton_exit;
    private javax.swing.JToolBar jToolBar3;
    private javax.swing.JToolBar jToolBar4;
    private javax.swing.JToolBar jToolBar5;
    private javax.swing.JToolBar jToolBar_editopanel_comparison;
    private javax.swing.JTree jTree_class;
    private javax.swing.JLabel overlapping;
    private javax.swing.JButton refresh;
    public static final javax.swing.JLabel res_conflictIcon = new javax.swing.JLabel();
    private javax.swing.JList suggestions;
    private javax.swing.JTextPane textPaneforClinicalNotes;
    private javax.swing.JLabel verifierFlagged;
    private javax.swing.JButton verifierOnAll;
    private javax.swing.JButton verifierOnCurrent;
    private javax.swing.JLabel workingConflicts;
    // End of variables declaration//GEN-END:variables
    //</editor-fold>
    
    //<editor-fold defaultstate="collapsed" desc="Generated Events - 2">
    private void infoListMouseMoved(java.awt.event.MouseEvent evt)//GEN-FIRST:event_infoListMouseMoved
    {//GEN-HEADEREND:event_infoListMouseMoved
        //Make sure we're viewing Annotations(either Verifier or Annotations Screen).
        if(currentScreen == infoScreens.ANNOTATIONS || currentScreen == infoScreens.VERIFIER)
        {
            //Make sure something is selected.
            if(infoList.getSelectedIndex() >= 0)
            {
                // Get item index
                int index = infoList.locationToIndex(evt.getPoint());

                // Get item
                Annotation item = (Annotation)infoList.getModel().getElementAt(index);

                // Return the tool tip text
                Depot depot = new Depot();

                //Clear out tooltips if the current mouse movement is not over the selected
                //item.
                if(infoList.getSelectedIndex() == index)
                    infoList.setToolTipText(depot.getContext(item));
                else
                    infoList.setToolTipText(null);
            }

        }
    }//GEN-LAST:event_infoListMouseMoved

    /**
     * JTabbedPane containing the Viewer, and the Annotation Info.
     *
     * @param evt - jTabbedPane3 state changed
     */
    private void jTabbedPane3StateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_jTabbedPane3StateChanged
    {//GEN-HEADEREND:event_jTabbedPane3StateChanged
        //if we're on the annotation information tab, then refresh the info.
        if(jTabbedPane3.getSelectedIndex() == 0)
            refreshResultEditor();
        else if(jTabbedPane3.getSelectedIndex() == 1)
            refreshInfo();
        else if(jTabbedPane3.getSelectedIndex()==2){
            // load report system to eHOST
            load_ReportSystem();
        }
    }//GEN-LAST:event_jTabbedPane3StateChanged


    /**
     * Button to run Verifier on all documents
     * @param evt - the button pressed event
     */
    private void verifierOnAllActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_verifierOnAllActionPerformed
    {//GEN-HEADEREND:event_verifierOnAllActionPerformed
        //Call Verifier with all and refresh the info.
        callVerifierWithAll();
        refreshInfo();
    }//GEN-LAST:event_verifierOnAllActionPerformed

    private void textPaneforClinicalNotesKeyPressed(java.awt.event.KeyEvent evt)//GEN-FIRST:event_textPaneforClinicalNotesKeyPressed
    {//GEN-HEADEREND:event_textPaneforClinicalNotesKeyPressed
        ResultEditor.WorkSpace.WorkSet.mouse_clicked_on = 2;;

        String text = textPaneforClinicalNotes.getText();
        if(WorkSet.currentAnnotation != null)
        {
            //Move the tail of the span
            if(evt.isAltDown() && !evt.isControlDown())
            {
                //Switch on the key
                switch(evt.getKeyCode())
                {
                    //shorten the tail if left key is also pressed
                    case KeyEvent.VK_LEFT:
                        this.spanEdit(spanedittype.tailshortentoLeft);
                        break;
                    //extend tail if the right key is also pressed
                    case KeyEvent.VK_RIGHT:
                        this.spanEdit(spanedittype.tailExtendtoRight);
                        break;
                }
            }
            //Move the head of the span
            else if(!evt.isAltDown() && evt.isControlDown())
            {
                //Switch on the key presed
                switch(evt.getKeyCode())
                {
                    //If left key is pressed then extend the head
                    case KeyEvent.VK_LEFT:
                        this.spanEdit(spanedittype.headExtendtoLeft);
                        break;
                    //If right key is pressed then shorten the span.
                    case KeyEvent.VK_RIGHT:
                        this.spanEdit(spanedittype.headShortentoRight);
                        break;
                    case KeyEvent.VK_Z:
                        restoreDeleted();
                        break;
                }
            }
            else
            {
                //Switch on the key presed
                switch(evt.getKeyCode())
                {
                    //If left key is pressed then extend the head
                    case KeyEvent.VK_LEFT:
                    case KeyEvent.VK_UP:
                        moveToNextAnnotation(false);
                        break;
                    //If right key is pressed then shorten the span.
                    case KeyEvent.VK_RIGHT:
                    case KeyEvent.VK_DOWN:
                        moveToNextAnnotation(true);
                        break;
                }
            }
        }

    }//GEN-LAST:event_textPaneforClinicalNotesKeyPressed

    private void formFocusGained(java.awt.event.FocusEvent evt)//GEN-FIRST:event_formFocusGained
    {//GEN-HEADEREND:event_formFocusGained

    }//GEN-LAST:event_formFocusGained

    private void formWindowGainedFocus(java.awt.event.WindowEvent evt)//GEN-FIRST:event_formWindowGainedFocus
    {//GEN-HEADEREND:event_formWindowGainedFocus

        //Somehow need to make pop menu keep focus.
        if(popmenu != null && popmenu.isGood())
        {
            System.out.println("popmenu open?");
            popmenu.getFocus();
            Toolkit.getDefaultToolkit().beep();
        }
        if(editor != null && editor.isVisible())
        {
            editor.requestFocus();
             Toolkit.getDefaultToolkit().beep();
        }
        if(classmanager != null && classmanager.isVisible())
        {
            System.out.println("classmanager open?");
            classmanager.requestFocus();
            Toolkit.getDefaultToolkit().beep();
        }
        if(simpleEditor != null && simpleEditor.isVisible())
        {
            simpleEditor.requestFocus();
            Toolkit.getDefaultToolkit().beep();
        }
    }//GEN-LAST:event_formWindowGainedFocus

    private void jToggleButton_ConverterActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jToggleButton_ConverterActionPerformed
    {//GEN-HEADEREND:event_jToggleButton_ConverterActionPerformed
         tabDoorman( TabGuard.tabs.converter);
    }//GEN-LAST:event_jToggleButton_ConverterActionPerformed

    private void jTree_classTreeExpanded(javax.swing.event.TreeExpansionEvent evt) {//GEN-FIRST:event_jTree_classTreeExpanded
        ResultEditor.AnnotationClasses.Mouse.NodeExpandedListener expanded = new
                ResultEditor.AnnotationClasses.Mouse.NodeExpandedListener( evt , jTree_class);
    }//GEN-LAST:event_jTree_classTreeExpanded

    private void jList_selectedAnnotationsKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jList_selectedAnnotationsKeyPressed
        ResultEditor.WorkSpace.WorkSet.mouse_clicked_on = 3;// TODO add your handling code here:
    }//GEN-LAST:event_jList_selectedAnnotationsKeyPressed

    private void jList_selectedAnnotationsMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList_selectedAnnotationsMousePressed
        ResultEditor.WorkSpace.WorkSet.mouse_clicked_on = 3;// TODO add your handling code here:
    }//GEN-LAST:event_jList_selectedAnnotationsMousePressed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton9ActionPerformed
    {//GEN-HEADEREND:event_jButton9ActionPerformed
        setRelationshipingEnabled(jButton9.isSelected()); 
    }//GEN-LAST:event_jButton9ActionPerformed
    
    private void jButton15ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton15ActionPerformed
    {//GEN-HEADEREND:event_jButton15ActionPerformed
        if(complexEditor == null || !complexEditor.isVisible())
        {
            complexEditor = new ComplexSchemaManager(this);
            complexEditor.setVisible(true);
        }
    }//GEN-LAST:event_jButton15ActionPerformed

    private void jButton16ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton16ActionPerformed
    {//GEN-HEADEREND:event_jButton16ActionPerformed
        if(simpleEditor == null || !simpleEditor.isVisible())
        {
            simpleEditor = new ResultEditor.SimpleSchema.Editor(this);
            simpleEditor.setVisible(true);
        }
    }//GEN-LAST:event_jButton16ActionPerformed


    /**
     * While user double clicked jTextField_annotatorMouse, set it editable for
     * coming modification to annotator information of current annotation.
     * 
     * jTextField_annotatorMouse is a component of text field used to show 
     * annotator information of current annotation.
     *
     * @param   evt
     *          Caught mouse event by system.
     */
    private void jTextField_annotatorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField_annotatorMouseClicked


        // do NOTHING, while there is no any annotation selected,
        if( ( ResultEditor.WorkSpace.WorkSet.currentAnnotation == null )
                || (jList_selectedAnnotations.getModel().getSize() < 1 ) )
        {
            jTextField_annotator.setEnabled(false);
            jTextField_annotator.setEditable(false);
            return;
        }

        // ##1## if is in mode of annotation comparing, this function will be disabled
        if(((UserInterface.AnnotationCompare.ExpandButton)jPanel60).isComparatorPanelExpanded()){
            return;
        }

        if (evt.getClickCount() == 2){
            jTextField_annotator.setEnabled(true);
            jTextField_annotator.setEditable(true);
        }
        
    }//GEN-LAST:event_jTextField_annotatorMouseClicked


    /**
     * While lost focus from this component which used to show annotator information
     * of current annotation, save changes and reset the component to uneditable.
     */
    private void jTextField_annotatorFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField_annotatorFocusLost

        if ( !jTextField_annotator.isEditable() )
            return;
        saveChanges_on_Annotator();

        // set this component is uneditable
        jTextField_annotator.setEnabled(false);
        jTextField_annotator.setEditable(false);
    }//GEN-LAST:event_jTextField_annotatorFocusLost


    /**
     * While user double clicked jTextArea_comment, set it editable for
     * coming modification to annotator comments of current annotation.
     * 
     * jTextArea_comment is a component of textarea used to show 
     * annotation comments of current annotation.
     *
     * @param   evt
     *          Caught mouse event by system.
     */
    private void jTextArea_commentMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextArea_commentMouseClicked

        // do NOTHING, while there is no any annotation selected,
        if( ( ResultEditor.WorkSpace.WorkSet.currentAnnotation == null )
                || (jList_selectedAnnotations.getModel().getSize() < 1 ) )
        {
            jTextArea_comment.setEnabled(false);
            jTextArea_comment.setEditable(false);
            jTextArea_comment.setBackground(new Color(240,240,240));
            return;
        }

        // ##1## if is in mode of annotation comparing, this function will be disabled
        if(((UserInterface.AnnotationCompare.ExpandButton)jPanel60).isComparatorPanelExpanded()){
            return;
        }
        
        if (evt.getClickCount() == 2){

            jTextArea_comment.setBackground(new Color(255,255,255));
            jTextArea_comment.setEditable(true);
            jTextArea_comment.setEnabled(true);
            jTextArea_comment.requestFocus();
            
        }
    }//GEN-LAST:event_jTextArea_commentMouseClicked


    /**
     * While lost focus from this component which used to show annotation comments
     * of current annotation, save changes and reset the component to uneditable.
     */
    private void jTextArea_commentFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextArea_commentFocusLost

        if ( !jTextArea_comment.isEditable() ){
            jTextArea_comment.setEnabled(false);
            jTextArea_comment.setEditable(false);
            jTextArea_comment.setBackground(new Color(240,240,240));
            return;
        }

        saveChanges_on_Comments();

        // set this component is uneditable
        jTextArea_comment.setEnabled(false);
        jTextArea_comment.setEditable(false);
        jTextArea_comment.setBackground(new Color(240,240,240));
    }//GEN-LAST:event_jTextArea_commentFocusLost

    private void jLabel_info_annotatorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel_info_annotatorMouseClicked
        if (evt.getClickCount()==2)
            changeAnnotator();
    }//GEN-LAST:event_jLabel_info_annotatorMouseClicked

    private void jLabel_infobar_FlagOfOraclejLabel_info_annotatorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel_infobar_FlagOfOraclejLabel_info_annotatorMouseClicked
        setFlag_of_OracleSimilarPhraseSeeker( !env.Parameters.enabledOracleSimilarPhraseSeeker );
    }//GEN-LAST:event_jLabel_infobar_FlagOfOraclejLabel_info_annotatorMouseClicked

    private void jLabel_infobar_FlagOfPathjLabel_info_annotatorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel_infobar_FlagOfPathjLabel_info_annotatorMouseClicked
        setFlag_of_GraphPath_Display( !env.Parameters.enabled_GraphPath_Display );
        try{this.display_showAnnotationDetail_onEditorPanel(ResultEditor.WorkSpace.WorkSet.currentAnnotation);
        } catch(Exception ex){}
    }//GEN-LAST:event_jLabel_infobar_FlagOfPathjLabel_info_annotatorMouseClicked

    private void jLabel_infobar_FlagOfDiffMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel_infobar_FlagOfDiffMouseClicked
        // if left mouse key pressed
        if( evt.getButton() ==1 ) {
            try{
                this.setFlag_of_DifferenceMatching_Display( !env.Parameters.enabled_Diff_Display );
                repaintHighlighter();
            } catch(Exception ex){

            }
        } else if( evt.getButton() == 3 ) {
            JPopupMenu popup = new JPopupMenu();
            final ActionListener menuListener = new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    UserInterface.DifferenceMatching.DefineDialog customdlg =
                            new UserInterface.DifferenceMatching.DefineDialog(GUI.this);
                    customdlg.setVisible(true);
                }
                
            };
            JMenuItem item;
            popup.add(item = new JMenuItem("Define Difference Matching", icon_difference_enabled));
            item.addActionListener(menuListener);
            popup.show(this.jLabel_infobar_FlagOfDiff, evt.getX(), evt.getY());
        }
    }//GEN-LAST:event_jLabel_infobar_FlagOfDiffMouseClicked

    private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton17ActionPerformed
        // user click accept button on editor panel
        ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).acceptreject_acceptPrimaryAnnotation();
    }//GEN-LAST:event_jButton17ActionPerformed

    private void jButton24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton24ActionPerformed
        // user click reject button on editor panel
        ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).acceptreject_rejectPrimaryAnnotation();
    }//GEN-LAST:event_jButton24ActionPerformed

    private void jButton25ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton25ActionPerformed
        ((UserInterface.AnnotationCompare.ExpandButton) jPanel60).acceptreject_ignorePrimaryAnnotation();
    }//GEN-LAST:event_jButton25ActionPerformed

    private void jList_complexrelationshipsMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_jList_complexrelationshipsMouseClicked
    {//GEN-HEADEREND:event_jList_complexrelationshipsMouseClicked
        // TODO add your handling code here:
        mouseClicked_onList(jList_complexrelationships);
    }//GEN-LAST:event_jList_complexrelationshipsMouseClicked

    private void jButton_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_saveActionPerformed
      
        // save function
        saveto_originalxml();
        commons.Tools.beep();
    }//GEN-LAST:event_jButton_saveActionPerformed

    private void jButton_removeduplicatesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_removeduplicatesActionPerformed
        // call class to pop up dialog to remove duplicates
        ResultEditor.Annotations.Opt.RemoveDuplicates rd = new
                ResultEditor.Annotations.Opt.RemoveDuplicates(this);
        rd.setVisible(true);
    }//GEN-LAST:event_jButton_removeduplicatesActionPerformed

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        
    }//GEN-LAST:event_formWindowClosed

    private void jList_complexrelationshipsValueChanged(javax.swing.event.ListSelectionEvent evt)//GEN-FIRST:event_jList_complexrelationshipsValueChanged
    {//GEN-HEADEREND:event_jList_complexrelationshipsValueChanged
        relationshipStuffChanged();

    }//GEN-LAST:event_jList_complexrelationshipsValueChanged

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
            
            this.setEnabled(false);

            // get coordinates of right working pane
            int x1 = Editor.getLocationOnScreen().x + NavigationPanel1.getWidth();
            int y1 = Editor.getLocationOnScreen().y;
            Point location = new Point(x1, y1); // coordinate of top left point
                                                // to the right working area
            int w = Editor.getWidth() - NavigationPanel1.getWidth();
            int h = Editor.getHeight();
            java.awt.Dimension size = new java.awt.Dimension(w,h);

            WorkSpace.SetWorkSpace setWS = new WorkSpace.SetWorkSpace(this, 
                    "call_from_Nav", location, size);
            setWS.setVisible(true);
            setWS.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
    }//GEN-LAST:event_jButton5ActionPerformed



    /**While user double clicking a project on the project list on the NAV pane,
     * list all corpus text files under it and show first one on result editor
     * pane;
     */
    private void jList_NAV_projectsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList_NAV_projectsMouseClicked

        try{
            if(evt.getClickCount()==2)
            {
                // ##1## empty the corpus list for current project
                env.ClinicalNoteList.CorpusLib.RemoveAll();

                // ##2## get selected folder
                int size = jList_NAV_projects.getModel().getSize();
                int selected = jList_NAV_projects.getSelectedIndex();
                if((selected<0)||(selected>size-1))
                    return;

                Object o = jList_NAV_projects.getModel().getElementAt(selected);
                if(o==null)
                    return;

                NavigatorContainer.ListEntry_Project entry = (NavigatorContainer.ListEntry_Project) o;

                File f = entry.getFolder();
                if(f==null) {
                    System.out.println("error 1102110353");
                    return;
                }
                // ##3## set current project
                env.Parameters.WorkSpace.CurrentProject = f;

                // #### load configure settings of this project
                config.project.ProjectConf projectconf = new config.project.ProjectConf(f);
                projectconf.loadConfigure();

                // open this folder
                setNAVCurrentTab(2);
                ActivedNVATAB=2;

                // loading saved annotation classanmes from oonfigure file
                System.out.println("#eHOST# Reading saved annotation classnames ...");
                new Thread(){
                    @Override
                    public void run(){
                        ResultEditor.AnnotationClasses.Depot depot =
                                new ResultEditor.AnnotationClasses.Depot();
                        // load save annotation classnames
                        depot.loadAnnotationClassnamesFromConfigureFile();
                    }
                }.start();

                // list txt files under corpus
                File[] corpus = listCorpus_inProjectFolder(f);
                listCorpus(corpus);


                // add into memory
                if(corpus!=null){
                    for(File txtfile:corpus){
                        if(txtfile==null)
                            continue;
                        env.ClinicalNoteList.CorpusLib.addTextFile(txtfile);
                    }
                }else{
                    env.ClinicalNoteList.CorpusLib.RemoveAll();
                }

                // update screen
                jCardcontainer_interactive.setVisible(true);
                showTextFiles_inComboBox();
                showFirstFile_of_corpus();

                // load saved annotations from "saved" folder
                ResultEditor.reloadSavedAnnotations.Reload.load(this);
                
                //showAnnotationCategoriesInTreeView_refresh();
                //this.showAnnotationCategoriesInTreeView_All();

                // update screen by these project parameters
                updateGUI_byProjectParameters();


                
            }
        }catch(Exception ex){

        }

    }//GEN-LAST:event_jList_NAV_projectsMouseClicked


    /**read file list from */
    public void refreshFileList(){
        File[] corpus = listCorpus_inProjectFolder(env.Parameters.WorkSpace.CurrentProject);
            listCorpus(corpus);

        // add into memory
            env.ClinicalNoteList.CorpusLib.RemoveAll();
            if(corpus!=null){
                for(File txtfile:corpus){
                    if(txtfile==null)
                        continue;
                    env.ClinicalNoteList.CorpusLib.addTextFile(txtfile);
                }
            }

            showTextFiles_inComboBox();
            goUserDesignated();
    }

    private void listCorpus(File[] corpus){
        Vector empty = new Vector();
        this.jList_corpus.setListData(empty);

        try{
            Vector<String> entries = new Vector<String>();
            for(File file:corpus){
                entries.add( file.getName() );
            }
            this.jList_corpus.setListData(entries);
            
            
        }catch(Exception ex){
            System.out.println("error 1101211147:: fail to list corpus on screen"
                    + ex.getMessage());
        }
    }

    /**List all txt files under the give project folder.*/
    private File[] listCorpus_inProjectFolder(File project){
        File[] txtfiles = null;

        try{
            // get corpus folder
            File corpusfolder=null;
            File[] files = project.listFiles();
            if(files==null)
                return null;
            for(File file:files){
                if(file.getName().toLowerCase().compareTo(env.CONSTANTS.corpus)==0){
                    corpusfolder = file;
                    break;
                }
            }

            if(corpusfolder==null)
                return null;

            File[] allcorpusfiles = corpusfolder.listFiles();
            if(allcorpusfiles==null)
                return null;
            int countfiles = 0;
            for(File file:allcorpusfiles){
                if(file.isFile()){
                    if(file.getName().toString().contains(".txt"))
                        countfiles++;
                }
            }

            int point=0;
            txtfiles = new File[countfiles];
            for(File file:allcorpusfiles){
                if(file.isFile()){
                    if(file.getName().toString().contains(".txt")) {
                        txtfiles[point] = file;
                        point++;
                    }
                }
            }


        }catch(Exception ex){
            System.out.println("error 1101211133::");
        }

        return txtfiles;
    }

    private void jLabel21MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel21MouseClicked

        // go to tab which has the list of project
        setNAVCurrentTab(1);
        jCardcontainer_interactive.setVisible(false);
        
        // save configure setting for current project which you just left
        config_saveProjectSetting();

        // set current project as NULL to indicate that you go back to
        // workspace level and there is no project got selected
        env.Parameters.WorkSpace.CurrentProject = null;

    }//GEN-LAST:event_jLabel21MouseClicked


    /** save configure setting for current project*/
    private void config_saveProjectSetting()
    {
        // get current project
        File currentproject = env.Parameters.WorkSpace.CurrentProject;
        // verify it before using
        if(currentproject==null)
            return;

        // save configure setting for current project
        config.project.ProjectConf projectconf
                = new config.project.ProjectConf(currentproject);
        
        projectconf.saveConfigure();
        
    }


    
    private void jButton_save1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_save1ActionPerformed
        
        PreAnnotation.Manager manager = new PreAnnotation.Manager(this);

        // make sure class of "person" and "Pronoun" has existed
        manager.confirmClassPerson();

        // search for terms of person
        manager.preannotation_toPairs();
        // marked terms of person with correlated relationship
        manager.MarkPairs();

        PreAnnotation.Pairs.Dictionary dict = new PreAnnotation.Pairs.Dictionary();
        dict.close();
        
    }//GEN-LAST:event_jButton_save1ActionPerformed

    private void jLabel22MouseReleased(java.awt.event.MouseEvent evt)//GEN-FIRST:event_jLabel22MouseReleased
    {//GEN-HEADEREND:event_jLabel22MouseReleased
        if(hotkeyDialog == null || !hotkeyDialog.isVisible())
        {
            hotkeyDialog = new HotKeys(this.getX(), this.getY(), this.getWidth(), this.getHeight());
            hotkeyDialog.setVisible(true);
        }
        else
        {
            hotkeyDialog.toFront();
        }
    }//GEN-LAST:event_jLabel22MouseReleased

    private void jList_corpusMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList_corpusMouseClicked
        if(evt.getClickCount() == 2 && evt.getButton() == MouseEvent.BUTTON1) {
            goUserDesignatedTable();
        }
    }//GEN-LAST:event_jList_corpusMouseClicked

    private void jButton_AddClinicalTexts1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AddClinicalTexts1ActionPerformed
        dialog_toCreateNewProject();
    }//GEN-LAST:event_jButton_AddClinicalTexts1ActionPerformed

    private void dialog_toCreateNewProject(){
        //this.setEnabled(false);

        // get coordinates of right working pane
        int x1 = Editor.getLocationOnScreen().x + NavigationPanel1.getWidth();
        int y1 = Editor.getLocationOnScreen().y;
        Point location = new Point(x1, y1); // coordinate of top left point
                                            // to the right working area
        int w = Editor.getWidth() - NavigationPanel1.getWidth();
        int h = Editor.getHeight();
        java.awt.Dimension size = new java.awt.Dimension(w,h);

        
        WorkSpace.NewProject newProject = new WorkSpace.NewProject(this, location, size);
        newProject.setVisible(true);
        newProject.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
    }

    private void jButton26ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton26ActionPerformed
        // user clicked "delete" button on NAV panel (project list)
        // to schedule a deleting operation to a selected projected
        deleteProject();
    }//GEN-LAST:event_jButton26ActionPerformed

    private void jComboBox_currentworkspace_abspathItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox_currentworkspace_abspathItemStateChanged

        if(jComboBox_currentworkspace_abspath.getItemCount()!= WorkSpace.Switcher.RecentWorkSpace.getItemCount())
            return;
        
        if(evt.getStateChange()==ItemEvent.SELECTED)
        {
            Object o = evt.getItem();
            if( (o==null) || (!(o instanceof File)) )
                return;

            File workspace = (File)o;
            
            env.Parameters.WorkSpace.WorkSpace_AbsolutelyPath = workspace.getAbsolutePath();
            refreshNAVProjects();
            
        }
    }//GEN-LAST:event_jComboBox_currentworkspace_abspathItemStateChanged

    private void edit_RelationshipsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_edit_RelationshipsActionPerformed
        setRelationshipingEnabled(true);
        if(this.jList_complexrelationships.getSelectedValue() != null)
            addingTo = ((iListEntry)this.jList_complexrelationships.getSelectedValue()).getRel();
        /*
        //See if Relationship combo box contains the current relationship...
        int size = jComboBox1.getModel().getSize();
        boolean canEdit = false;
        for(int i = 0; i< size; i++)
        {
            if(jComboBox1.getModel().getElementAt(i).toString().equals(((iListEntry)this.jList_complexrelationships.getSelectedValue()).getRel().getMentionSlotID()))
            {
                jComboBox1.setSelectedIndex(i);
                canEdit = true;
                jButton9.setSelected(true);
                addingTo = ((iListEntry)this.jList_complexrelationships.getSelectedValue()).getRel();
            }
        }
        if(!canEdit)
        {

            //Build Error String
            String toDisplay = "Relationship is not in the current schema, so it can not be edited!\n";

            //Pop up message
            Toolkit.getDefaultToolkit().beep();
            JOptionPane.showMessageDialog(this, toDisplay);
        }

         *
         */
    }//GEN-LAST:event_edit_RelationshipsActionPerformed

    private void delete_RelationshipsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_delete_RelationshipsActionPerformed
        iListEntry toDelete = (iListEntry)this.jList_complexrelationships.getSelectedValue();
        if(toDelete!=null)
        {
            ComplexRelationship relToDelete = toDelete.getRel();
            WorkSet.currentAnnotation.ComplexRelationships.remove(relToDelete);
        }
        this.updateComplex();
    }//GEN-LAST:event_delete_RelationshipsActionPerformed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        Verification2011 verify = new Verification2011(this);
        verify.setVisible(true);
        refreshInfo();
    }//GEN-LAST:event_jButton8ActionPerformed

    private void jButton27ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton27ActionPerformed
        Depot depot = new Depot();
        for(Article art: depot.getAllArticles())
        {
            System.out.println(art.filename);
            File[] possibleMatches = env.ClinicalNoteList.CorpusLib.getFiles();
            for(File f: possibleMatches)
            {
                if(f.getName().equals(art.filename))
                {
                    VerifyChallenge2011 verify = new VerifyChallenge2011(art, f);
                    try
                    {
                        ArrayList<Annotation> annots = verify.outputVerify();
                        depot.setAnnotationsVisible(annots, art);
                    }
                    catch(FileNotFoundException e)
                    {
                        System.out.println(e.getMessage());
                    }
                }
            }
            //File currentTextSource = env.ClinicalNoteList.CorpusLib.
            //VerifyChallenge2011 temp = new VerifyChallenge2011(art, );
        }
        refreshInfo();
        //refreshResultEditor();
    }//GEN-LAST:event_jButton27ActionPerformed

    private void jRadioButton_treeview_overallActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton_treeview_overallActionPerformed
        navigatorRangeChange();
}//GEN-LAST:event_jRadioButton_treeview_overallActionPerformed

    private void jRadioButton_treeview_currentarticleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton_treeview_currentarticleActionPerformed
        navigatorRangeChange();
}//GEN-LAST:event_jRadioButton_treeview_currentarticleActionPerformed

    private void jToggleButton_DictionaryManager1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton_DictionaryManager1ActionPerformed
        tabDoorman( TabGuard.tabs.assignmentsScreen );
    }//GEN-LAST:event_jToggleButton_DictionaryManager1ActionPerformed


    /** user clicked "delete" button on NAV panel (project list) to schedule a
     * deleting operation to a selected project.
     */
    private void deleteProject()
    {

        // get coordinates of right working pane
        int x1 = Editor.getLocationOnScreen().x + NavigationPanel1.getWidth();
        int y1 = Editor.getLocationOnScreen().y;
        Point location = new Point(x1, y1); // coordinate of top left point
                                            // to the right working area
        int w = Editor.getWidth() - NavigationPanel1.getWidth();
        int h = Editor.getHeight();
        java.awt.Dimension size = new java.awt.Dimension(w,h);

        // call class to handle the deleting and confirmation operations
        WorkSpace.DeleteProject delProject = new WorkSpace.DeleteProject(
                this, jList_NAV_projects, location, size);

        delProject.delete();
    }


    private static int widerwidth=0;    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Public Methods">
    /**set flag and corrlated lable's icon and tiptool text.*/
    public void setFlag_of_OracleSimilarPhraseSeeker(boolean enabled_or_not ){
        try{
            env.Parameters.enabledOracleSimilarPhraseSeeker = enabled_or_not;

            if(enabled_or_not){
                jLabel_infobar_FlagOfOracle.setIcon(icon_oracle_enabled);
                jLabel_infobar_FlagOfOracle.setToolTipText("Oracle Dialog Enabled to find similar annotations.");
            } else {
                jLabel_infobar_FlagOfOracle.setIcon(icon_oracle_disabled);
                jLabel_infobar_FlagOfOracle.setToolTipText("Oracle Dialog DISABLED!");
            }
        }catch(Exception ex){
            System.out.println("error 1010111612:: fail to set status and icon to indicate oracle ");
        }
    }
    
    /**set flag and corrlated lable's icon and tiptool text.*/
    public void  setFlag_of_GraphPath_Display(boolean enabled_or_not ){
        try{
            env.Parameters.enabled_GraphPath_Display = enabled_or_not;

            if(enabled_or_not){
                jLabel_infobar_FlagOfPath.setIcon(icon_graphicpath_enabled);
                jLabel_infobar_FlagOfPath.setToolTipText("View relationships.");
            } else {
                jLabel_infobar_FlagOfPath.setIcon(icon_graphicpath_disabled);
                jLabel_infobar_FlagOfPath.setToolTipText("Hided relationships!");
            }
        }catch(Exception ex){
            System.out.println("error 1010111612:: fail to set status and icon to graph path ");
        }
    }


    /**set flag and corrlated lable's icon and tiptool text.*/
    public void  setFlag_of_DifferenceMatching_Display(boolean enabled_or_not ){
        try{
            env.Parameters.enabled_Diff_Display = enabled_or_not;

            if(enabled_or_not){
                jLabel_infobar_FlagOfDiff.setIcon(icon_difference_enabled);

            } else {
                jLabel_infobar_FlagOfDiff.setIcon(icon_difference_disabled);
            }
        }catch(Exception ex){
            System.out.println("error 1010111612:: fail to set status and icon to graph path ");
        }
    }
    public void highlightAnnotations(String annotationname ) {
        // highlight manger
        final ResultEditor.UnderlinePainting.HighlightPainter highlighter =
            new ResultEditor.UnderlinePainting.HighlightPainter(textPaneforClinicalNotes);
        highlighter.RemoveAllUnderlineHighlight();

        if ( annotationname == null )
            return;
        if ( annotationname.trim().length() < 1 )
            return;

        File currentTextSource = ResultEditor.WorkSpace.WorkSet.getCurrentFile();
        ResultEditor.Annotations.Depot depot = new ResultEditor.Annotations.Depot();
        ResultEditor.Annotations.Article article = depot.getArticleByFilename( currentTextSource.getName() );
        if ( article == null )
            return;
        boolean isCarePositionSet = false;
        for( ResultEditor.Annotations.Annotation annotation : article.annotations ){
            if ( annotation == null )
                continue;
            if ( annotation.annotationText.trim().compareTo( annotationname.trim() ) == 0 ){
                highlighter.addNewUnderlineHightlight( annotation.spanstart, annotation.spanend );
                if( !isCarePositionSet ) {
                    display_setCarpetOn( annotation.spanstart );
                    isCarePositionSet = true;
                }
            }
        }

    }
    /**
     * Add text source files into memory. Before adding, check repetitive and
     * only add these files who are new to current text source list.
     *
     * @param   textfiles
     *          List of files we want to add into current list of text sources.
     */
    public void addTextFiles(Vector<File> textfiles){
        if ( textfiles == null )
            return;

        for( File file : textfiles )
            addTextFile( file );
    }

    /**
     * Add just one text source files into memory. Before adding, check repetitive and
     * only add file who is new to current text source list.
     *
     * @param   textfile
     *          The text file we want to add into current list of text sources.
     */
    public void addTextFile(File textfile){
        env.ClinicalNoteList.CorpusLib.addTextFile( textfile );
    }

    /**
     * Show text information on the bar at the bottom of the GUI.
     *
     * @param   textinfo
     *          The text string you want to show on the bar at the bottom of the GUI.
     */
    public void showText_OnBottomInfoBar(String textinfo){
        this.jLabel_infobar.setText(textinfo);
    }

    /**Set Caret position */
    public void setFocusOn(int position){
        display_setCarpetOn(position);
    }

    public void updateComplex()
    {
        if(WorkSet.currentAnnotation != null)
        {
            this.display_showAnnotationDetail_onEditorPanel(WorkSet.currentAnnotation);
            this.showSelectedAnnotations_inList(0);
        }
    }    

    public boolean isShowAnnotations_toAllDoc(){
        if (jRadioButton_treeview_currentarticle.isSelected())
            return false;
        else return true;
    }

    /**Update value to screen while init the GUI of eHOST.*/
    public void updateScreen_for_variables(){
        try{
            // update screen for annotator name
            ResultEditor.Annotator.Manager annotatormanager = new
                    ResultEditor.Annotator.Manager(this.jLabel_info_annotator);
            annotatormanager.showCurrentAnnotator();

            setFlag_of_OracleSimilarPhraseSeeker(env.Parameters.enabledOracleSimilarPhraseSeeker);
            setFlag_of_GraphPath_Display(env.Parameters.enabled_GraphPath_Display );
            setFlag_of_DifferenceMatching_Display(env.Parameters.enabled_Diff_Display );
            
        }catch(Exception ex){

        }
    }
    public void display_setCarpetOn(int position)
    {
        try{
            // get visible window of the text panel
            int viewy1 = this.textPaneforClinicalNotes.getVisibleRect().y;
            int viewy2 = this.textPaneforClinicalNotes.getVisibleRect().y 
                       +  this.textPaneforClinicalNotes.getVisibleRect().height;

             Rectangle rect = this.textPaneforClinicalNotes.getUI().modelToView(this.textPaneforClinicalNotes, position);

             if (rect==null)
                 return;

             if((rect.y <= viewy2+10)&&(rect.y >= viewy1+10))
                 return;

             this.textPaneforClinicalNotes.setCaretPosition(position);
        }catch(Exception ex){
        
        }
    }

    
    /**
     * Called to display or refresh all different matching of current document
     * on text viewer
     */
    public void showDifferentMatching(){
        try{

            // remove all existing wave underlines
            ResultEditor.UnderlinePainting.HighlightPainter painter
                    = new ResultEditor.UnderlinePainting.HighlightPainter(this.textPaneforClinicalNotes);
            painter.RemoveAllWaveHighlight();

            // get current test source
            File curr_f = ResultEditor.WorkSpace.WorkSet.getCurrentFile();

            

        }catch(Exception ex){
        }
    }


    /**Use difference information stored in inner class "flags_of_differences"
     * to set the borders of corrlated components. Use red rectangles to indicate
     * difference.
     *
     * This function only can be called after you have run function of
     * "checkDifferences(Annotation)".
     */
    public void display_setRedRectangle_toMarkDifferences(
            final boolean isDifference_inSpan,
            final boolean isDifference_inClass,
            final boolean isDifference_inComment,
            final boolean isDifference_inAnnotator,
            final boolean isDifference_inComplexRelationship,
            final boolean isDifference_inNormalRelationship
            ){

        display_removeRectangle_toPotensionMarkedDifferences();

        // ##1## set boarder if annotation span difference found
        try{
            if ((isDifference_inSpan)&&(env.Parameters.DifferenceMatching.checkatt_forSpan)){
                jTextField_spanLocation.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0), 2));
            }else{
                jTextField_spanLocation.setBorder(null);
            }
        }catch(Exception ex){System.out.println("error 1011162346::21");}

        // ##3## set boarder if annotation span difference found
        try{
            if ((isDifference_inClass)&&(env.Parameters.DifferenceMatching.checkatt_forClass)){
                jTextField_annotationClassnames.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0), 2));
            }else{
                jTextField_annotationClassnames.setBorder(null);
            }
        }catch(Exception ex){System.out.println("error 1011162346::23");}

        // ##4## set boarder if  difference found in annotation comments
        try{
            if ((isDifference_inComment)&&(env.Parameters.DifferenceMatching.checkatt_forComment)){
                jPanel66.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0), 2));
            }else{
                jPanel66.setBorder(null);
            }
        }catch(Exception ex){System.out.println("error 1011162346::24");}

        // ##5## set boarder if  difference found in annotator of annotations
        try{
            if ((isDifference_inAnnotator)&&(env.Parameters.DifferenceMatching.checkatt_forAnnotator)){
                jTextField_annotator.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0), 2));
            }else{
                jTextField_annotator.setBorder(null);
            }
        }catch(Exception ex){System.out.println("error 1011162346::25");}


        // ##6## set boarder if  difference found in complex relationships of annotations
        try{
            if ((isDifference_inComplexRelationship)&&(env.Parameters.DifferenceMatching.checkatt_forComplex)){
                jPanel70.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0), 2));
            }else{
                jPanel70.setBorder(null);
            }
        }catch(Exception ex){System.out.println("error 1011162346::26");}

        // ##7## set boarder if  difference found in normal relationships of annotations
        try{
            if ((isDifference_inNormalRelationship)&&(env.Parameters.DifferenceMatching.checkatt_forNormal)){
                jPanel71.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0), 2));
            }else{
                jPanel71.setBorder(null);
            }
        }catch(Exception ex){System.out.println("error 1011162346::27");}

    }


    /**This function will set normal border to these components whose border
     * maybe be set to red rectangle to show differences in annotation
     * comparasion mode.
     */
    public void display_removeRectangle_toPotensionMarkedDifferences(){

        // ##1## set boarder if annotation span difference found
        jTextField_spanLocation.setBorder(null);

        // ##3## set boarder if annotation span difference found
        jTextField_annotationClassnames.setBorder(null);


        // ##4## set boarder if  difference found in annotation comments
        jPanel66.setBorder(null);


        // ##5## set boarder if  difference found in annotator of annotations
        jTextField_annotator.setBorder(null);



        // ##6## set boarder if  difference found in complex relationships of annotations
        jPanel70.setBorder(null);


        // ##7## set boarder if  difference found in normal relationships of annotations
        jPanel71.setBorder(null);

    }

    /**Forbiding any modification operation while eHOST enter the mode of
     * comparing differences between annotations.
     *
     * It will be called from class "UserInterface.AnnotationCompare.ExpandButton.java"
     */
    public void display_DisabledEditorModification_forCompareMode(){
        jButton_SelectClass.setVisible(false);
        //jButton_relationships.setVisible(false);
        edit_Relationships.setEnabled(false);
        delete_Relationships.setEnabled(false);
        //jButton_relationships.setVisible(false);
   
    }

    /**Allow modification operation after eHOST leaving the mode of
     * comparing differences between annotations.
     *
     * It will be called from class "UserInterface.AnnotationCompare.ExpandButton.java"
     */
    public void display_EnabledEditorModification_forLeaveCompareMode(){
        jButton_SelectClass.setVisible(true);
        //jButton_relationships.setVisible(true);
        if(this.jList_complexrelationships.getSelectedIndex() >= 0)
        {
            if(WorkSet.makingRelationships)
                edit_Relationships.setEnabled(true);
            delete_Relationships.setEnabled(true);
        }
        //jButton_relationships.setVisible(true);
    }

    /**show all classes in tree view*/
    public void showAnnotationCategoriesInTreeView_refresh(){

        ResultEditor.AnnotationClasses.ShowClassesInTreeView sct =
                new ResultEditor.AnnotationClasses.ShowClassesInTreeView(jTree_class, this);
        sct.refreshTypeMemory_refresh();
        
        sct.display();
        
    }

    public void showAnnotationCategoriesInTreeView_All(){
        ResultEditor.AnnotationClasses.ShowClassesInTreeView sct =
                new ResultEditor.AnnotationClasses.ShowClassesInTreeView(jTree_class, this);
        sct.refreshTypeMemory_all();
        
        sct.display();
        
    }

    public void showAnnotationCategoriesInTreeView_CurrentArticle(){
        
        boolean onlyShowCurrentArticle = this.jRadioButton_treeview_currentarticle.isSelected();
        File currentfile = ResultEditor.WorkSpace.WorkSet.getCurrentFile();
        if (onlyShowCurrentArticle) {
            if((currentfile == null)||(currentfile.getName().trim().length() < 1)){
                showAnnotationCategoriesInTreeView_All();
                return;
            }else{
                ResultEditor.AnnotationClasses.ShowClassesInTreeView sct =
                        new ResultEditor.AnnotationClasses.ShowClassesInTreeView(jTree_class, this);
                sct.refreshTypeMemory_currentArticle( currentfile.getName().trim() );
                sct.display();
                
            }
        }else{ this.showAnnotationCategoriesInTreeView_All(); }
        
    }

    public void showAnnotationCategoriesInTreeView_selectCategory(String category, String annotation_text){
        ResultEditor.AnnotationClasses.ShowClassesInTreeView sct =
                new ResultEditor.AnnotationClasses.ShowClassesInTreeView(jTree_class, this);
        sct.setCategoryNodeSelected( category, annotation_text );
    }



    public void setAnnotationVisible(){
        ResultEditor.AnnotationClasses.ShowClassesInTreeView sct =
                new ResultEditor.AnnotationClasses.ShowClassesInTreeView(jTree_class, this);
        sct.setAnnotationsVisile();
    }
    public void totalRefresh()
    {
        // clear all attributes value display and disable those buttons as
        // no annotation are selected just after annotations been imported.
        disableAnnotationDisplay();

        this.showAnnotationCategoriesInTreeView_refresh();

        currentScreen = infoScreens.NONE;
        refreshInfo();

        showValidPositionIndicators();
    }

    public void showTextFiles_inComboBox(){
        // add file names to the vector
        int size = env.ClinicalNoteList.CorpusLib.getSize();
        jComboBox_InputFileList.removeAllItems();
        // show inputted file into the combobox
        for (int i = 0; i < size; i++) {
            jComboBox_InputFileList.addItem(env.ClinicalNoteList.CorpusLib.getFileName(i));
        }
    }
    
    /**
     * Show all text sources in the memory onto the screen.
     */
    /*public void showTextFiles(){

        // clean the table
        ((DefaultTableModel) jTable_SelectedClinicalFiles.getModel()).getDataVector().removeAllElements();
        ((DefaultTableModel) jTable_SelectedClinicalFiles.getModel()).fireTableDataChanged();

        // show in the table
        for (int i = 0; i < env.Parameters.LIST_ClinicalNotes.size(); i++) {
            Object[] row = {
                (Object)env.Parameters.LIST_ClinicalNotes.get(i).filename,
                (Object)env.Parameters.LIST_ClinicalNotes.get(i).amountOfWords
            };
            ((DefaultTableModel) jTable_SelectedClinicalFiles.getModel()).addRow(row);

        }
        ((DefaultTableModel) jTable_SelectedClinicalFiles.getModel()).fireTableDataChanged();

        // show on screen: how many clinical text files get selected
        jLabel_filecollection.setText(" >FILE COLLECTION (" + env.Parameters.LIST_ClinicalNotes.size()+")");

        // attribute of component: not editable
        jComboBox_InputFileList.setEditable(false);
        textPaneforClinicalNotes.setEditable(false);
    }*/

    /* this funcation only be called by dialogs.exit after you had click the yes or no button
     * if yes, then close the whole application
     * o.w, do nothing
     */
    public void after_click_exit(boolean _YES_or_NO) {
        if ( _YES_or_NO )   System.exit(-99);
    }

    /**Show dialog of exit confirmation.*/
    public void showExitConfirmDialog(){
        // program will confirm whether user clicked button exit to exit
        confirmExit.setSize(416, 200);
        int x = this.getX() + (int) ((this.getWidth() - confirmExit.getWidth()) / 2);
        int y = this.getY() + (int) ((this.getHeight() - confirmExit.getHeight()) / 2);
        confirmExit.setLocation(x, y);
        confirmExit.setModal(true);
        confirmExit.setVisible(true);

        this.after_click_exit(Flag_Want_Shutdown_Program);
    }
    
    /**empty all attributes/text field in result editor, which maybe got
     * used in pervious operation */
    public void disableAnnotationDisplay()
    {
        display_Remove_ComplexGraphPath();

        Vector v = new Vector();
        v.clear();
        jList_selectedAnnotations.setListData(v);
        jList_normalrelationship.setListData(v);
        jList_complexrelationships.setListData(v);
        //jLabel_typeOfRelationship.setText("Attributes: ");
        jTextPane_explanations.setText(null);
        suggestions.setListData(v);
        jTextField_spanLocation.setText(null);
        jTextArea_comment.setText("");
        jList3.setBorder(null);
        jList3.setListData(v);
        jTextField_annotationClassnames.setText(null);

        jTextField_annotator.setText(null);
        jTextField_annotator.setBorder(standardTextfieldBoard);

        jTextField_creationdate.setText(null);
        jTextField_creationdate.setBorder(standardTextfieldBoard);

        jButton_SelectClass.setEnabled(false);


        // refresh screen only if the text pane is visiable go user;
        // otherwise, do nothing.
        if(textPaneforClinicalNotes.isVisible())
        {
            ResultEditor.UnderlinePainting.HighlightPainter painter = new ResultEditor.UnderlinePainting.HighlightPainter(
                this.textPaneforClinicalNotes);
            painter.RemoveAllUnderlineHighlight();
        }
    }

    public void remove_all_underline_highlighter(){
        ResultEditor.UnderlinePainting.HighlightPainter painter = new ResultEditor.UnderlinePainting.HighlightPainter(
                this.textPaneforClinicalNotes);
        painter.RemoveAllUnderlineHighlight();
    }

    public void enable_AnnotationEditButtons(){
        // enable buttons for span and class edit
        jButton_SelectClass.setEnabled(true);
        jButton3.setEnabled(true);
        jButton10.setEnabled(true);
        jButton_spaneditor_delete.setEnabled(true);
        jButton4.setEnabled(true);
        jButton11.setEnabled(true);
        jButton_SelectClass.setEnabled(true);
        //jButton_relationships.setEnabled(true);
        if(this.jList_complexrelationships.getSelectedIndex() >= 0)
        {
            if(WorkSet.makingRelationships)
                edit_Relationships.setEnabled(true);
            delete_Relationships.setEnabled(true);
        }
        jButton_relationships1.setEnabled(true);
    }

    /**Show your selected annotations in list and show details of first
     * annotaion's details on related field. You you left clicked mouse on
     * a position of a text source. You may select one or more annotaions who
     * span cover the point you just clicked;
     *
     * @param initializeIndex    Index of annotations marked as preselected in the list.
     * This annotation will be highlighted by colorful under line. */
    public void showSelectedAnnotations_inList(int initializeIndex){

        ResultEditor.SelectedAnnotationView.AnnotationListScreen list
                = new ResultEditor.SelectedAnnotationView.AnnotationListScreen(
                    this,
                    this.jList_selectedAnnotations,
                    this.jLabel_icon_annotationlist.getIcon());
        list.showAnnotations(initializeIndex);
    }

    public void display_showSelectedAnnotations_inListOnEditorPanel(int uniqueindex){

        ResultEditor.SelectedAnnotationView.AnnotationListScreen list
                = new ResultEditor.SelectedAnnotationView.AnnotationListScreen(
                    this,
                    this.jList_selectedAnnotations,
                    this.jLabel_icon_annotationlist.getIcon());
        list.showAnnotations_withSpecificUniqueindex(uniqueindex);
    }
    /**clean and repaint all background highlight indicator in the text pane */
    public void repaintHighlighter(){
        //removeAllBeckgroundHighlight();
        //paintBackgroundHighlight();
        ResultEditor.Display.Screen screen = new ResultEditor.Display.Screen(
                textPaneforClinicalNotes,
                WorkSet.getCurrentFile() );
        screen.repaintHighlight();

    }
    /**
     * This function is called only from annotations comparator, for accept or
     * reject annotations;
     * It only show one annotation from the selected annotation set; Other
     * annotation will be show on the comparator panel as alternative items.
     * This function is very similar to method "showSelectedAnnotations_inList";
     *
     * @param   uniqueindex */
    public void display_showOneAnnotation_inListOnEditorPanel(int uniqueindex){

        try{
            ResultEditor.SelectedAnnotationView.AnnotationListScreen list
                = new ResultEditor.SelectedAnnotationView.AnnotationListScreen(
                    this,
                    this.jList_selectedAnnotations,
                    this.jLabel_icon_annotationlist.getIcon());

            list.onlyshowAnnotation(uniqueindex);

        }catch(Exception ex){
            System.out.println("error 1011152253:: fail to show one annotation " +
                    "in the editor panel for annotation accept/reject!!!");
        }
    }

    public void display_showAnnotationDetail_onEditorPanel(ResultEditor.Annotations.Annotation annotation){
        //System.out.println("show details: annotation:"+annotation.toString());
        disableAnnotationDisplay();

        if ( annotation == null ) {
            System.out.println("error 1011170312:: the annotation which you " +
                    "want to show details on screen is empty!!!");
            return;

        } else {

            ResultEditor.WorkSpace.WorkSet.currentAnnotation = annotation;

            // show graph path for complex relationships if have
            if(env.Parameters.enabled_GraphPath_Display)
                display_Set_ComplexGraphPath( annotation );

            String location = annotation.spanstart + " | " + annotation.spanend;
            String annotator = annotation.annotator;

            jTextField_spanLocation.setText( location );
            jTextField_annotator.setText(null);
            jTextField_annotationClassnames.setText( annotation.annotationclass );

                // mark its classname in the navigator panel
                showAnnotationCategoriesInTreeView_selectCategory( annotation.annotationclass, annotation.annotationText );

                if( (annotation.annotator != null )&&( annotation.annotator.trim().length() > 0) ) {
                    jTextField_annotator.setText( annotation.annotator);
                    jTextField_annotator.setBorder(standardTextfieldBoard);
                } else {
                    jTextField_annotator.setText(null);
                    setRedBorder( jTextField_annotator );
                }

                if( (annotation.creationDate != null )&&( annotation.creationDate.trim().length() > 0) ) {
                    jTextField_creationdate.setText( annotation.creationDate);
                    jTextField_creationdate.setBorder(standardTextfieldBoard);
                } else {
                    jTextField_creationdate.setText( null );
                    setRedBorder(jTextField_creationdate);
                }

            // textsourceFilename of current text source
            String textsourceFilename = ResultEditor.WorkSpace.WorkSet.getCurrentFile().getName();

            // get selected annotations by mouse's positin
            ResultEditor.Annotations.Depot depot = new ResultEditor.Annotations.Depot();
            Vector<Integer> selectedAnnotationUniqueindexes = Depot.SelectedAnnotationSet.getSelectedAnnotationSet();

            int size = selectedAnnotationUniqueindexes.size();
            String textsourcefilename = ResultEditor.WorkSpace.WorkSet.getCurrentFile().getName();
            Vector<suggestion> suggested = new Vector<suggestion>();
            Vector<String> explanations = new Vector<String>();
            for (int i = 0; i < size; i++) {
                int index = selectedAnnotationUniqueindexes.get(i);
                ResultEditor.Annotations.Annotation anAnnotation = depot.getAnnotationByUnique(textsourcefilename, index);
                for (suggestion suggest : anAnnotation.verifierFound) {
                    if (!explanations.contains(suggest.getExplanation()))
                        explanations.add(suggest.getExplanation());
                    else if (!suggested.contains(suggest))
                        suggested.add(suggest);
                }
            }
            String explanationText = "";
            for (String explained : explanations) {
                explanationText += explained + "\n";
            }
            this.suggestions.setListData(suggested);
            suggestions.setSelectedIndex(0);
            jTextPane_explanations.setText(explanationText);
            jTextArea_comment.setText(annotation.comments);
            setVerifierSuggestion(annotation.verifierSuggestion);
            displayRelationships(annotation);

        }
    }

    public void showRelationships_Refresh(){
        // get current annotation
        ResultEditor.Annotations.Annotation annotation
                = ResultEditor.WorkSpace.WorkSet.currentAnnotation;

        // refresh display of attributes of this annotation in result editor
        displayRelationships( annotation );

    }
    

    /**if suggestions of a annotation is not empty, show contents and highlight the rectangle in red lines.*/
    public void setVerifierSuggestion(Vector<String> suggestions){
        if ((suggestions == null)||(suggestions.size() <1)) {
            jList3.setBorder(null);
            Vector v = new Vector();
            jList3.setListData(v);
            return;
        }else{
            int size = suggestions.size();
            jList3.setListData(suggestions);
            setRedBorder();
        }

    }

    /** highlight specific words or phrases */
    public void hilightPhrase( Annotation annot){
        // offset as there might have some conflict button in this textpane
        //int offset = ResultEditor.Conflicts.ConflictButtonPainter.getScreenOffset(start, 1);
        //jLabel1.setText("offset = "+ offset);

        // highlight manger
        final ResultEditor.UnderlinePainting.HighlightPainter hightlighter =
            new ResultEditor.UnderlinePainting.HighlightPainter(textPaneforClinicalNotes);
        hightlighter.setNewUnderlineHightlight(annot);
    }
    
     public void goUserDesignated(String filename){
        if (( filename == null )||(filename.trim().length() < 1))
            return;
        int size = jComboBox_InputFileList.getModel().getSize();
        for( int i = 0; i<size; i++){
            if ( jComboBox_InputFileList.getItemAt(i).toString().equals(filename) ){
                jComboBox_InputFileList.setSelectedIndex(i);

                ResultEditor.WorkSpace.WorkSet.setCurrentFile(i);
                File f = ResultEditor.WorkSpace.WorkSet.getAllTextFile()[i];
                ResultEditor.WorkSpace.WorkSet.setCurrentFile(f);

                goUserDesignated();
                return;
            }
        }

        System.out.println("1008190444 - fail to find index of designated text source.");
    }


    public void display_SetStatusInsiable_ToComparisionPanel(){
        ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).setStatusInvisiable();
    }
    public void paintBackgroundHighlight(){
    }

    public void removeSelection(){
        //textPaneforClinicalNotes.setSelectionStart( 0 );
        textPaneforClinicalNotes.setSelectionEnd( -1 );

    }

    public void addPositionIndicator(){
        ResultEditor.PositionIndicator.Display assemble = new
                ResultEditor.PositionIndicator.Display( this, this.jPanel_position_indicator_container );
    }

    /**indicate the position indicator*/
    public void setPositionIndicator( ResultEditor.PositionIndicator.JPositionIndicator positionindicator ){
        if ( ( positionindicator != null )
                &&( positionindicator instanceof ResultEditor.PositionIndicator.JPositionIndicator ))
            this.jpositionIndicator = positionindicator;
    }

    /**
     * by users' click, dicide which navigator menu item got selected and then
     * active related panel.
     *
     * @param   i   0 means first panel, 1 means second panel
     */
    public void setNAVCurrentTab( int i ){
        
        CardLayout card = (CardLayout) jPanel_NAV_CardContainer.getLayout();
        switch(i) {
            case 2:
                //((ResultEditor.CustomComponents.NagivationMenuItem)jPanel_SelectFiles).setSelected();
                //((ResultEditor.CustomComponents.NagivationMenuItem)jPanel_AnnotationsAndMarkables).setNormal();
                card.show( jPanel_NAV_CardContainer, "card3");
                this.ActivedNVATAB = 2;
                break;
            case 3:
                //((ResultEditor.CustomComponents.NagivationMenuItem)jPanel_SelectFiles).setNormal();
                //((ResultEditor.CustomComponents.NagivationMenuItem)jPanel_AnnotationsAndMarkables).setSelected();

                card.show( jPanel_NAV_CardContainer, "card2");
                ((NavigatorContainer.TabPanel)NavigationPanel1).setTabActived("Markables");
                break;
            case 1:                
                card.show( jPanel_NAV_CardContainer, "card4");
                this.ActivedNVATAB = 1;
                display_refreshNAV_WorkSpace();
                break;
        }
    }

    /**remove and then redraw all position indicators*/
    public void showValidPositionIndicators(){
        try{
            if(jTabbedPane3.getSelectedIndex() == 0)
            {
                File file = ResultEditor.WorkSpace.WorkSet.getCurrentFile();
                //System.out.println( "current show position indicators for file:[" + file.getName().trim() + "]" );
                jpositionIndicator.removeAllIndicators();
                jpositionIndicator.paintArticle( file.getName().trim() );
                jpositionIndicator.forcepaint();
                jpositionIndicator.repaint();
            }
        }catch(Exception ex){
            System.out.println("error 1103141511:: fail to show valid postion indicators"
                    + ex.getMessage());
        }
    }

    public void showValidPositionIndicators_setAll(){
        this.jpositionIndicator.removeDesignatedAnnotation();
    }

    public void showValidPositionIndicators_setDesignated(String annotationname){
        this.jpositionIndicator.setDesignatedAnnotation(annotationname);
    }
    
    public void checkWorkSpaceDialog(){
        // check results
        String path = env.Parameters.WorkSpace.WorkSpace_AbsolutelyPath;
        boolean success_inWorkspaceSetting = isValidWorkspace(path);

        if(success_inWorkspaceSetting)
        {

            // record recent accessed workspace
            recordRecentUsedWorkspace(path);
            
            this.jCardcontainer_interactive.setVisible(true);
            //((ResultEditor.CustomComponents.ExpandablePanel)NavigationPanel).defaultstatus();
            ((ResultEditor.CustomComponents.ExpandablePanel_editor)NavigationPanel_editor).defaultstatus();
            config.system.SysConf.saveSystemConfigure();
            this.refreshNAVProjects();
        }else{
            commons.Tools.beep();
            System.out.println("1102110425::current workspace path is invalid!!!");
            setWorkSpace();
        }

    }

    /**This method will call Workspace.Switcher.RecentWOrkspac to record
     * recent used workspace;
     */
    private void recordRecentUsedWorkspace(String _path)
    {
        File workspace = new File(_path);

        WorkSpace.Switcher.RecentWorkSpace rw = new WorkSpace.Switcher.RecentWorkSpace();
        rw.addWorkspace(workspace);
        
    }


    public void refreshNAVProjects(){
        display_refreshNAV_WorkSpace();
        config.system.SysConf.saveSystemConfigure();
    }

    public void reavtiveMainPanel(){
        this.jCardcontainer_interactive.setVisible(true);
        //((ResultEditor.CustomComponents.ExpandablePanel)NavigationPanel).defaultstatus();
        ((ResultEditor.CustomComponents.ExpandablePanel_editor)NavigationPanel_editor).defaultstatus();
    }


    /**Remove all layer Components from eHOST gui*/
    public void display_RemoveAllLayeredComponents() {
        this.getLayeredPane().removeAll();
    }
    
    /**Subsequence processes after all components got initilized; Only need to
     * be called in the contructor to class GUI
     */
    public void componentPostProcessing()
    {

        // workspace list
        jComboBox_currentworkspace_abspath.setPreferredSize(new Dimension(300, 27));

        // seting the tab panel
        ((NavigatorContainer.TabPanel)NavigationPanel1).expand();

        this.setNAVonFirstOrSecondPage();

        ((ResultEditor.CustomComponents.ExpandablePanel_editor)NavigationPanel_editor).setDiffSplitPane(jSplitPane_Annotations_Comparator);
        //((ResultEditor.CustomComponents.ExpandablePanel_editor)NavigationPanel_editor).
        // Import components into custom component, expandable button, for
        // control.
        ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).setContainerPart(
                this.jPanel_comparator_container,
                jButton_spaneditor_delete,
                jLabel8,
                jToolBar_editopanel_comparison,
                // list for displaying selected annotations in editor panel
                jList_selectedAnnotations,
                this,
                textPaneforClinicalNotes
             );


        // After all component(no null) have been imported into this expandable
        // button set default status and gui for this custom component of
        // expandable button.
        ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).setStatusInvisiable();
        


        // Bind a keystroke to the button for act "save".
        jButton_save.setMnemonic(KeyEvent.VK_S);


        NLP.PostProcess.ExtractToDocumentViewer.setGUI(this);

        

    }


    public static void show_latest_mention_id() {
        //jLabel_mentionid.setText("Latest ID= "
        //        + String.valueOf(env.Parameters.getLatestUsedMentionID()));
    }
    /**
     * This method will change an annotation to a suggested annotation
     * @param toChange - the annotation to change
     * @param theRightOne - the text to match
     */
    public void changeAnnotationToSuggestion(Annotation toChange, suggestion theRightOne)
    {
        boolean refreshScreen = false;
        //Used to send to span editor.
        int delete = 0, headdecrease = 1, tailincrease = 2,
                headincrease = 3, taildecrease = 4;
        if (theRightOne != null)
        {
            //Extract the difference between the start spans and end spans of the suggested and current.
                int headChange = toChange.spanstart - theRightOne.getStart();
                int endChange = toChange.spanend - theRightOne.getEnd();
                //If the original head is greater than the suggested then shift left.
                if(headChange > 0)
                {
                    //Keep shifting until we have shifted to the suggested position.
                    for (int shifts = 0; shifts < headChange ; shifts++)
                    {
                        ResultEditor.SpanEdit.SpanEditor spanEditor =
                                new ResultEditor.SpanEdit.SpanEditor(textPaneforClinicalNotes);
                        if (spanEditor.editCurrentDisplayedSpan(headdecrease) > 0)
                        {
                            refreshScreen = true;
                        }
                    }
                }
                //If the original head is less than the suggested head then shift right.
                else if(headChange < 0)
                {
                    //Keep shifting unil we have reached the suggested position.
                    for (int shifts = 0; shifts < Math.abs(headChange) ; shifts++)
                    {
                        ResultEditor.SpanEdit.SpanEditor spanEditor =
                                new ResultEditor.SpanEdit.SpanEditor(textPaneforClinicalNotes);
                        if (spanEditor.editCurrentDisplayedSpan(headincrease) > 0)
                        {
                            refreshScreen = true;
                        }
                    }
                }
                //If the original end is greater than the suggested end, shift left.
                if(endChange > 0)
                {
                    //Shift until we reach the suggested position.
                    for (int shifts = 0; shifts < endChange ; shifts++)
                    {
                        ResultEditor.SpanEdit.SpanEditor spanEditor =
                                new ResultEditor.SpanEdit.SpanEditor(textPaneforClinicalNotes);
                        if (spanEditor.editCurrentDisplayedSpan(taildecrease) > 0)
                        {
                            refreshScreen = true;
                        }
                    }
                }
                //If the original end is less than the suggested end, shift right.
                else if(endChange<0)
                {
                    //Keep shifting until we reach the suggested position.
                    for (int i = 0; i < Math.abs(endChange) ; i++)
                    {
                        ResultEditor.SpanEdit.SpanEditor spanEditor =
                                new ResultEditor.SpanEdit.SpanEditor(textPaneforClinicalNotes);
                        if (spanEditor.editCurrentDisplayedSpan(tailincrease) > 0)
                        {
                            refreshScreen = true;
                        }
                    }
                }
        }
        if (refreshScreen)
        {
            //Get the new verifier result for this annotation.
            checkOneVerifier(WorkSet.indexOfCurrentAnnotation);

            disableAnnotationDisplay();
            this.repaintHighlighter();
            showSelectedAnnotations_inList(env.Parameters.latestSelectedInListOfMultipleAnnotions);

        }
    }
    public enum spanedittype{
        headExtendtoLeft, headShortentoRight,tailExtendtoRight,
        tailshortentoLeft, delete
    };



    public void spanEdit(spanedittype _type)
    {

        boolean refreshScreen = false;
        // current file name
        ResultEditor.SpanEdit.SpanEditor spanEditor  =
                new ResultEditor.SpanEdit.SpanEditor(textPaneforClinicalNotes);
        int delete = 0, headdecrease = 1, tailincrease = 2,
                headincrease = 3, taildecrease =4;

        switch(_type){

            case delete:
                if(spanEditor.editCurrentDisplayedSpan(delete)>0){
                    refreshScreen = true;
                    disable_AnnotationEditButtons();
                }
                break;
            case headExtendtoLeft:
                if(spanEditor.editCurrentDisplayedSpan(headdecrease)>0){
                    refreshScreen = true;
                }
                break;
            case tailExtendtoRight:
                if(spanEditor.editCurrentDisplayedSpan(tailincrease)>0){
                    refreshScreen = true;
                }
                break;
            case headShortentoRight:
                if(spanEditor.editCurrentDisplayedSpan(headincrease)>0){
                    refreshScreen = true;
                }
                break;
            case tailshortentoLeft:
                if(spanEditor.editCurrentDisplayedSpan(taildecrease)>0){
                    refreshScreen = true;
                }
                break;
        }


        try{
            if(refreshScreen){
                int selected = jComboBox_InputFileList.getSelectedIndex();
                //showFileContextInTextPane(selected , 0 );
                this.repaintHighlighter();

                disableAnnotationDisplay();
                if(_type != spanedittype.delete)
                {
                    //showSelectedAnnotations_inList( ResultEditor.WorkSpace.WorkSet.latestValidClickPosition);
                    // ##1## if is in mode of annotation comparing, this function will be disabled
                    if(((UserInterface.AnnotationCompare.ExpandButton)jPanel60).isComparatorPanelExpanded())
                        display_showOneAnnotation_inListOnEditorPanel(ResultEditor.WorkSpace.WorkSet.currentAnnotation.uniqueIndex);
                    else
                        showSelectedAnnotations_inList(env.Parameters.latestSelectedInListOfMultipleAnnotions);

                    this.enable_AnnotationEditButtons();
                }
                // after an annotation just got deleted, show other annotaitons if have;
                else if (  (Depot.SelectedAnnotationSet.getSelectedAnnotationSet()!=null)
                       &&(Depot.SelectedAnnotationSet.getSelectedAnnotationSet().size() > 0))
                {
                    showSelectedAnnotations_inList(0);
                    this.enable_AnnotationEditButtons();
                }

                //textPaneforClinicalNotes.setCaretPosition(latestCarePostion);
                //textPaneforClinicalNotes.setLocation(point);

            }
        }catch(Exception ex){
            System.out.println("error 1012011438:: fail to refresh screen after " +
                    "span modified!!!");
        }

        //backtoPreviousFocusPoint();

        if ( _type != spanedittype.delete )
            jButton_SelectClass.setEnabled(true);
        else jButton_SelectClass.setEnabled(false);

        if(_type == spanedittype.delete){
            showAnnotationCategoriesInTreeView_refresh();
            showValidPositionIndicators();
        }

    }

    /**This method can help you go back or refresh the result editor. */
    public void refreshResultEditor()
    {
        // latest cursor postion
        // int latestCarePostion = textPaneforClinicalNotes.getCaretPosition();
        // jToggleButton1.setSelected(false);
        File current_raw_document = ResultEditor.WorkSpace.WorkSet.getCurrentFile();
        if(current_raw_document==null)
            showFileContextInTextPane( 0, 0 );
        else


            showFileContextInTextPane( current_raw_document, 0 );
        disableAnnotationDisplay();
        //textPaneforClinicalNotes.setCaretPosition(latestCarePostion);
        showSelectedAnnotations_inList( env.Parameters.latestSelectedInListOfMultipleAnnotions );
        enable_AnnotationEditButtons();

        /*backtoPreviousFocusPoint();*/

    }
    
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Private Methods - Misc.">
    /**save function: save annotaitons from memory to their original xml files.
     * The difference between "save" and "save as" is that user are allowed to
     * save annotations belongs to designated files and assigned directionary.
     */
    private void saveto_originalxml(){
        // save annotations to XML
        ResultEditor.Save.Save saver = new ResultEditor.Save.Save(this);
        String return_msg = saver.quickXMLSaving();

        // show return msg on buttom bar
        this.showText_OnBottomInfoBar(return_msg);
    }
    private void setDocumentFontSize(int fontsize){

        // 1 change font size in current text panel
        ResultEditor.Display.Screen screen = new ResultEditor.Display.Screen(this.textPaneforClinicalNotes);
        screen.changeDisplayFontSize(fontsize);

        // 2 keep parameter of font size into mono text display
        //ResultEditor.Display.Screen.setFontSize(fontsize);

        // 3 keep parameter of font size to background highlight
    }



    private void navigatorRangeChange(){
        if( jRadioButton_treeview_currentarticle.isSelected() ){
            showAnnotationCategoriesInTreeView_CurrentArticle( );
        } else if( this.jRadioButton_treeview_overall.isSelected() ){
            showAnnotationCategoriesInTreeView_All();
        }
    }
    /**call class to start process of saving annotations and its attributes into xml or pins files.*/
    private void saveChanges(){
        ResultEditor.Save.Save saver = new ResultEditor.Save.Save(this);
        saver.savechanges();
    }


    /**
     * This method will change the selected annotation to whichever suggestion is currently
     * selected in the suggestions jList.
     */
    private void changeSelectedToSuggestion()
    {
        //int latestScrollBarValue = jScrollPane_textpane.getVerticalScrollBar().getValue();
        ResultEditor.Annotations.Annotation toChange = WorkSet.currentAnnotation;
        suggestion theRightOne = (suggestion) suggestions.getSelectedValue();
        changeAnnotationToSuggestion(toChange, theRightOne);

    }


    /**
     * This method will check a single annotation for potential problems using the
     * verifier.
     * @param originalArrayIndex - The Array Index of the annotation in the static storage space.
     * @return - any potential problems, or null if there are none.
     */
    private void checkOneVerifier(int originalArrayIndex)
    {

        Verifier.SpanCheck spanCheck = new Verifier.SpanCheck(
                env.ClinicalNoteList.CorpusLib.getAbsoluteFileName(jComboBox_InputFileList.getSelectedIndex()), env.Parameters.VERIFIER_DICTIONARIES);
        spanCheck.findProblems(originalArrayIndex);

    }
    public void show_dialog_of_preference_to_manage_dictionaries()
    {

        // get coordates and size of current window
        int parentX, parentY, parentWidth, parentHeight;
        parentX = this.getX();
        parentY = this.getY();
        parentHeight = this.getHeight();
        parentWidth = this.getWidth();

        // show the dialog(frame) of preference to modify pre-annoated concept dictinaries
        Setting pf = new Setting(parentX, parentY, parentWidth, parentHeight, this);
        pf.setVisible(true);
    }
    /**This function could be call to show anntotation details while you select
     * one annotation in the annotation list on the document viewer gui.
     *
     * @param   selectedIndex_inList
     *          the index of select items in the jlist of selected annotations
     */
    private void showDetailsByIndex(int selectedIndex_inList){

        // do nothing,
        // if there is no entry show in the list of multiple annotations
        if( jList_selectedAnnotations.getModel().getSize() < 1 )
            return;

        try{
            // filename of current text source
            String currentTextSource = ResultEditor.WorkSpace.WorkSet.getCurrentFile().getName();


            // get indexes of selected annotations in the article in the depot
            ResultEditor.Annotations.Depot depot = new ResultEditor.Annotations.Depot();
            Vector<Integer> selectedannotations = Depot.SelectedAnnotationSet.getSelectedAnnotationSet();
            if (selectedannotations==null)
                return;
            if (selectedannotations.size() < 1)
                return;


            ResultEditor.Annotations.Annotation annotation = depot.getAnnotationByUnique( currentTextSource, selectedannotations.get( selectedIndex_inList) );
            // record to indicate current annotation and its index in the artile in the depot
            ResultEditor.WorkSpace.WorkSet.currentAnnotation = annotation;
            ResultEditor.WorkSpace.WorkSet.indexOfCurrentAnnotation = selectedannotations.get( selectedIndex_inList );

            // put information on screen
            jTextField_spanLocation.setText( String.valueOf( annotation.spanstart )+ " | " + String.valueOf( annotation.spanend ) );
            jTextField_annotationClassnames.setText( annotation.annotationclass );
            showAnnotationCategoriesInTreeView_selectCategory( annotation.annotationclass, annotation.annotationText );


            jTextArea_comment.setText( annotation.comments );

            jTextField_annotator.setText(null);

            if( (annotation.annotator != null )&&( annotation.annotator.trim().length() > 0) ) {
                jTextField_annotator.setText( annotation.annotator);
                jTextField_annotator.setBorder(standardTextfieldBoard);
            } else setRedBorder( jTextField_annotator );

            if( (annotation.creationDate != null )&&( annotation.creationDate.trim().length() > 0) ) {
                jTextField_creationdate.setText( annotation.creationDate);
                jTextField_creationdate.setBorder(standardTextfieldBoard);
            } else setRedBorder( jTextField_creationdate );

            setVerifierSuggestion( annotation.verifierSuggestion );

            displayRelationships( annotation );

            hilightPhrase( annotation);


            display_setCarpetOn( annotation.spanstart );

        }catch(Exception e){
            Logs.ShowLogs.printWarningLog("GUI refresh error - loading result " +
                    "editor - 20311 ! \n"+e.toString());
        }


    }
    /**
     * Call this when a mouse click occurs on the Jlist. Invert 'selected' variable
     * for the selected iListEntry.
     * @param thislist - the list that had a mouse click.
     */
    private void mouseClicked_onList(JList thislist) {


            iListEntry thisterm = (iListEntry)thislist.getSelectedValue();
            if(thisterm == null)
                return;
            int size = thislist.getModel().getSize();
            for(int i = 0; i< size; i++)
            {
                iListEntry otherTerm = (iListEntry)thislist.getModel().getElementAt(i);
                otherTerm.setSelected(false);
            }
            thisterm.setSelected(true);

    }
    /**load resources from files, such as pictures, icons, etc.*/
    private void loadRes(){
        try{
            icon_oracle_disabled = new javax.swing.ImageIcon(getClass().getResource("/res/oracle_icon_s_disabled.png"));
            icon_oracle_enabled = new javax.swing.ImageIcon(getClass().getResource("/res/oracle_icon_s_enabled.png"));
            icon_graphicpath_enabled = new javax.swing.ImageIcon(getClass().getResource("/res/object-to-path_enabled.png"));
            icon_graphicpath_disabled = new javax.swing.ImageIcon(getClass().getResource("/res/object-to-path_disabled.png"));
            icon_difference_enabled = new javax.swing.ImageIcon(getClass().getResource("/res/path-difference.png"));
            icon_difference_disabled = new javax.swing.ImageIcon(getClass().getResource("/res/path-difference_disabled.png"));
        }catch(Exception ex){
        }
    }

    /** Clean the table and reload file list into the table.*/
    /*private void cleanAndReload_ListOfFileCollection() {
        // empty the table for list of selected clinical notes
        Vector<String> listdata = new Vector<String>();
        jList_corpus.setListData(listdata);

        // show clinical note textsourceFilename and amount of words in rows
        int size = env.Parameters.LIST_ClinicalNotes.size();
        for (int i = 0; i < size; i++) {
            // buld row
            listdata = env.Parameters.LIST_ClinicalNotes.get(i).filename,
                (Object)env.Parameters.LIST_ClinicalNotes.get(i).amountOfWords
            };
            // add row data into table
            ((DefaultTableModel) jTable_SelectedClinicalFiles.getModel()).addRow(row);

        }
        ((DefaultTableModel) jTable_SelectedClinicalFiles.getModel()).fireTableDataChanged();


        // show information on GUI: amount of selected clinical notes
        jLabel_filecollection.setText(" FILE COLLECTION ("+size+")");

    }*/
    
    private void smallerFontSize(){
        if( this.currentFontSize <= 6 ) {
            commons.Tools.beep();
            return;
        }else{
            this.currentFontSize = this.currentFontSize - 1;
            setDocumentFontSize( this.currentFontSize );
        }
    }

    private void biggerFontSize(){
        if( this.currentFontSize >= 50 ) {
            commons.Tools.beep();
            return;
        }else{
            this.currentFontSize = this.currentFontSize + 1;
            setDocumentFontSize( this.currentFontSize );
        }
    }
    /**assign the postion of this dialog.*/
    private void setDialogPosition(){
        // set the perfect size of this window
        int perfectWidth = 1080;
        int perfectHeight = 768;
        this.setSize(perfectWidth, perfectHeight);

        // **** setting the location of gui window
        Dimension winSize = Toolkit.getDefaultToolkit().getScreenSize();
        int screenWidth = winSize.width;
        int screenHeight = winSize.height;
        // if screen have enough space for this window, show it within its prefect size
        // otherwise, use the maxsize of the display device
        if ((screenWidth >= perfectWidth) && (screenHeight >= perfectHeight)) {
            int x = (int) (screenWidth - perfectWidth) / 2;
            int y = (int) (screenHeight - perfectHeight) / 2;
            this.setSize(perfectWidth, perfectHeight);
            this.setLocation(x, y);
        } else {
            this.setSize(screenWidth, screenHeight);
            this.setLocation(0, 0);
        }
    }
    /**
     * Save changes of annotator information to current annotation while
     * component of textfield which used to show annotator information lost
     * its focus.
     */
    private void saveChanges_on_Annotator(){
        String newAnnotator = jTextField_annotator.getText();

        // get current annotation
        ResultEditor.Annotations.Annotation annotation = null;
        try{
            annotation = ResultEditor.WorkSpace.WorkSet.currentAnnotation;
        }catch(Exception ex){
            System.out.println("Error 1009231634 : fail to get current while try to save changes of annotator!");
        }

        // validity check
        if (( annotation == null )|| (!(annotation instanceof ResultEditor.Annotations.Annotation )) ){
            System.out.println("Error 1009231636 : fail to get current while try to save changes of annotator!");
            return;
        }

        // save changes of annotator to current annotation
        try{
            annotation.annotator = newAnnotator;
        }catch(Exception ex){
            System.out.println("Error 1009231637 : fail to to save changes of annotator!");
            return;
        }

    }

    /**
     * Save changes of comment to current annotation while
     * component of textfield which used to show annotator information lost
     * its focus.
     */
    private void saveChanges_on_Comments(){
        String newComment = jTextArea_comment.getText();

        // get current annotation
        ResultEditor.Annotations.Annotation annotation = null;
        try{
            annotation = ResultEditor.WorkSpace.WorkSet.currentAnnotation;
        }catch(Exception ex){
            System.out.println("Error 1009231710 : fail to get current while try to save changes of comments!");
        }

        // validity check
        if (( annotation == null )|| (!(annotation instanceof ResultEditor.Annotations.Annotation )) ){
            System.out.println("Error 1009231711 : fail to get current while try to save changes of comments!");
            return;
        }

        // save changes of annotator to current annotation
        try{
            annotation.comments = newComment;
        }catch(Exception ex){
            System.out.println("Error 1009231712 : fail to to save changes of comment!");
            return;
        }

    }


    /** Set hand cursor to these java visilable components */
    private void setHandCursor(){
        jButton13.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton14.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton21.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton22.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton18.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton19.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton20.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton_save.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton_removeduplicates.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );

        //Set Annotation Information tab to hand cursors.
        annotations.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        annotators.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        overlapping.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        workingConflicts.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        verifierFlagged.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );

        jButton_spaneditor_delete.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton3.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton10.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton11.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton_SelectClass.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton11.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        //jButton_relationships.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton_relationships1.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
        jButton23.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );

        jLabel_info_annotator.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jLabel_info_annotatorlabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jTextArea_comment.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jLabel_infobar_FlagOfOracle.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jLabel_infobar_FlagOfPath.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jLabel_infobar_FlagOfDiff.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jLabel22.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    }
    /**add drop event handing process to list of text source, whose type is JTable.*/
    private void dropEventOfTextSourceList(){
        //jTable_SelectedClinicalFiles.setDropMode(DropMode.USE_SELECTION);
       // jTable_SelectedClinicalFiles.setDragEnabled(false);
        //jTable_SelectedClinicalFiles.setDropTarget(null);
    }
    /**pop up a dialog to let u change current annotator.*/
    private void changeAnnotator(){
        try{
            ResultEditor.Annotator.ChangeAnnotator changeannotator = new
                    ResultEditor.Annotator.ChangeAnnotator(this);
            changeannotator.setVisible(true);

        }catch(Exception ex){

        }
    }

    /**
     * Display: remove all graph path from text panel. These graph pathes were
     * used to show links between annotaions who have complex relationships.
     */
    private void display_Remove_ComplexGraphPath()
    {
        if(!jCardcontainer_interactive.isVisible())
            return;
        
        try{
            ((UserInterface.TxtScreen.TextScreen)this.textPaneforClinicalNotes).
                    clearComplexRelationshipCoordinates();
            
        }catch(Exception ex){
            System.out.println();
        }

    }


    /** show graph path for complex relationships if have.
     *
     * @param   annotation
     *          The annotation which we will draw out graph path of its complex
     *          relationships if it has.
     */
    private void display_Set_ComplexGraphPath( ResultEditor.Annotations.Annotation annotation ){

        if((annotation==null)||(annotation.ComplexRelationships == null))
            return;

        try{
            Depot depot = new Depot();
            if( depot == null )
                return;
            int count=0;
            Color source_color, linked_color;

            source_color = ResultEditor.AnnotationClasses.Depot.getColor(annotation.annotationclass.trim());

            for(ComplexRelationship complex: annotation.ComplexRelationships) {
                for(ResultEditor.Annotations.eComplex end: complex.getLinkedAnnotations()) {
                    Annotation linkedAnnotation = depot.getAnnotationByUnique(
                            WorkSet.getCurrentFile().getName(),
                            end.linkedAnnotationIndex
                        );
                    if(linkedAnnotation==null)
                        continue;

                    count++;

                    int x = linkedAnnotation.spanstart;
                    int y = linkedAnnotation.spanend;
                    linked_color = ResultEditor.AnnotationClasses.Depot.getColor(linkedAnnotation.annotationclass.trim());

                    if( count==1 ){
                        ((UserInterface.TxtScreen.TextScreen)this.textPaneforClinicalNotes).setComplexRelationsCoordinates(
                                annotation.spanstart,
                                annotation.spanend,
                                source_color,
                                x, y, linked_color);
                    }else{
                        ((UserInterface.TxtScreen.TextScreen)this.textPaneforClinicalNotes).setComplexRelationsCoordinates_extraEnds(x, y, linked_color);
                        //System.out.println("extra x= "+ x +", y = " + y);
                    }

                }
            }
            Graphics g1=((UserInterface.TxtScreen.TextScreen)this.textPaneforClinicalNotes).getGraphics();
            ((UserInterface.TxtScreen.TextScreen)this.textPaneforClinicalNotes).paint(g1);

        }catch(Exception ex){
            System.out.println("error 1010132130:: fail to set graph path for complex relationship of current annotation!!!");
        }

    }
    
    /**
     * Search designated text content from current text in the text area of result
     * editor. And highlight results(found terms) with two black bar on them.
     * Give a beep as warnning if nothing got found.
     */
    private void searchWord(){
        ResultEditor.WordSearcher.Searcher wordsearcher =
                new ResultEditor.WordSearcher.Searcher( textPaneforClinicalNotes, this );
        wordsearcher.find( jTextField_searchtext.getText() );
    }
    private boolean isValidWorkspace(String path){
        boolean success_inWorkspaceSetting=false;

            if(path==null)
                return false;
            if(path.trim().length()<1)
                return false;

            File f = new File(path);
            if(!f.exists())
                return false;
            if(f.isFile())
                return false;

            return true;
    }

    /**check and set workspace setting*/
    private void setWorkSpace()
    {
        String workspace_path = env.Parameters.WorkSpace.WorkSpace_AbsolutelyPath;
        if (( workspace_path == null) || (workspace_path.trim().length()<1))
        {
            this.jCardcontainer_interactive.setVisible(false);
            this.setEnabled(false);

            WorkSpace.SetWorkSpace setWS = new WorkSpace.SetWorkSpace(this);
            setWS.setVisible(true);
            setWS.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
        }
        else
        {
            //this.jCardcontainer_interactive.setVisible(true);
            System.out.println("current workspace = ["
                    + env.Parameters.WorkSpace.WorkSpace_AbsolutelyPath
                    + "]");
        }
    }
    
    /**
     * Redraw the highlighting and only draw the passed in annotations
     * @param currentlyViewing - the annotations to highlight.
     */
    private void repaintNewAnnotations(Vector<Annotation> currentlyViewing)
    {
        Depot depot = new Depot();
        Article article = depot.getArticleByFilename(WorkSet.getCurrentFile().getName());
        depot.setAnnotationsVisible(currentlyViewing, article);

        //repaint
        jpositionIndicator.removeAllIndicators();
        jpositionIndicator.paintArticle(WorkSet.getCurrentFile().getName().trim());
        jpositionIndicator.forcepaint();
        jpositionIndicator.repaint();

        //go to file viewer to view newly painted annotations
        int selected = jComboBox_InputFileList.getSelectedIndex();
        showFileContextInTextPane(selected, 0);
        jTabbedPane3.setSelectedIndex(0);
    }
    /**
     * Move the focus from the selected annotation to the annotation that is after the selected annotation.
     * @param next - true if you're looking for the next annotation, false if you're looking for the previous annotation
     */
    private void moveToNextAnnotation(boolean next)
    {
        ResultEditor.WorkSpace.WorkSet.latestScrollBarValue = jScrollPane_textpane.getVerticalScrollBar().getValue();

        //Get the current article so we can search for the 'next' annotation
        Depot depot = new Depot();
        Article article = depot.getArticleByFilename(WorkSet.getCurrentFile().getName());

        //Get the current annotation so we can use it to find the next annotation
        Annotation current= WorkSet.currentAnnotation;

        //This will store the current minimum distance between two annotations
        int min = Integer.MAX_VALUE;

        //This will store our current minimum distance annotation
        Annotation currentNext = null;

        //Loop through all annotations to find a minimum distance
        for(Annotation possibleNext: article.annotations)
        {
            //If the this annotation is closer to the selected annotation then any found so far, and it is not before
            //then set this annotation to be the closes annotation
            if(next && possibleNext.spanstart - current.spanstart < min && possibleNext.spanstart - current.spanstart > 0)
            {
                min = possibleNext.spanstart- current.spanstart;
                currentNext = possibleNext;
            }
            //If we're looking for the previous annotation then just do the opposite comparison..
            if(!next && current.spanstart - possibleNext.spanstart  < min && current.spanstart - possibleNext.spanstart > 0)
            {
                min = current.spanstart-possibleNext.spanstart;
                currentNext = possibleNext;
            }
        }
        //If we found an annotation after the selected one, then display info for it
        //and jump to it.
        if(currentNext != null)
        {
            displayInfoForAnnotation(new Object[]{currentNext});
            display_setCarpetOn(currentNext.spanstart);
        }
    }
    /**
     * Display the info for the annotations
     * @param annotations - the annotations to display info for.
     */
    private void displayInfoForAnnotation(Object[] annotations)
    {
        Vector<Annotation> toSet = new Vector<Annotation>();
        for(Object annotation: annotations)
        {
            toSet.add((Annotation)annotation);
        }

        Depot depot = new Depot();
        Depot.SelectedAnnotationSet.setSets(depot.getUniqueIndexByAnnotation(toSet));
        showSelectedAnnotations_inList(0);

    }
    /**
     * Set the list of info to annotations with the selected class. This should
     * use a class using the annotation information format.
     * ***Does not support classes with spaces*****
     *
     * @param selectedClass - the selected class.
     */
    private void selectAClass(String selectedClass)
    {
        //To store the list of annotations with the selected class
        Vector<Annotation> toDisplay = new Vector<Annotation>();

        //Strip out the actual class name.
        selectedClass = selectedClass.split(" ")[2];

        //Loop through all annotations to find those with matching classes.
        for(Annotation annotation: annotationsList)
        {
            if(annotation.annotationclass.equals(selectedClass))
                toDisplay.add(annotation);
        }

        //Alphabetize and display
        Collections.sort(toDisplay);
        infoList.setListData(toDisplay);
        jLabel29.setText(selectedClass);
    }

    private void disable_AnnotationEditButtons(){
        // disable buttons for span and class edit
        jButton_SelectClass.setEnabled(false);
        jButton3.setEnabled(false);
        jButton10.setEnabled(false);
        jButton_spaneditor_delete.setEnabled(false);
        jButton4.setEnabled(false);
        jButton11.setEnabled(false);
        jButton_SelectClass.setEnabled(false);
        //jButton_relationships.setEnabled(false);
        edit_Relationships.setEnabled(false);
        delete_Relationships.setEnabled(false);
        jButton_relationships1.setEnabled(false);

         Vector v = new Vector();
         jList3.setListData(v);
         jList3.setBorder(null);

    }

    private void setRedBorder(JTextField textfield ){
        javax.swing.border.Border lines = new javax.swing.border.LineBorder(Color.RED, 3);
        textfield.setBorder(lines);
    }

    private void setRedBorder(){
        javax.swing.border.Border lines = new javax.swing.border.LineBorder(Color.RED, 3);
        jList3.setBorder(lines);
    }
    
    // while clicking button to enter gui of interactive editor, do fellowing things:
    private void enter_Interactive() {

        // show all classes in the tree view
        showAnnotationCategoriesInTreeView_refresh();
        setScreen_toInteractive();
    }
    

    private void setScreen_toInteractive()
    {
        

        // not editable
        jComboBox_InputFileList.setEditable(false);

        textPaneforClinicalNotes.setEditable(false);
        textPaneforClinicalNotes.setText(null);



        // add file names to the vector
        int size = env.ClinicalNoteList.CorpusLib.getSize();
        jComboBox_InputFileList.removeAllItems();
        if (size<1)
                return;
        // show inputted file into the combobox
        for (int i = 0; i < size; i++) {
            jComboBox_InputFileList.addItem(env.ClinicalNoteList.CorpusLib.getFileName(i));
        }
        showFileContextInTextPane(jComboBox_InputFileList.getSelectedIndex(), 0);

    }

    private void goBack_ChoicedFile() {
        int selected = jComboBox_InputFileList.getSelectedIndex();

        if (selected > 0) {
            jComboBox_InputFileList.setSelectedIndex(selected - 1);
            showFileContextInTextPane(selected - 1, 0);

            this.showAnnotationCategoriesInTreeView_CurrentArticle();
            this.showValidPositionIndicators_setAll();
            this.showValidPositionIndicators();

        } else {
            Toolkit.getDefaultToolkit().beep();
        }
        disable_AnnotationEditButtons();

        //currentScreen = infoScreens.NONE;
        refreshInfo();
    }

    private void gotoNextChoicedFile() {
        // numbers of items in the filelist
        int size = jComboBox_InputFileList.getItemCount();

        int selected = jComboBox_InputFileList.getSelectedIndex();

        if (selected < (size - 1)) {
            jComboBox_InputFileList.setSelectedIndex(selected + 1);
            
                showFileContextInTextPane(selected + 1, 0);
            
                this.showAnnotationCategoriesInTreeView_CurrentArticle();
                this.showValidPositionIndicators_setAll();
                this.showValidPositionIndicators();
            
        } else {
            Toolkit.getDefaultToolkit().beep();
        }

        disable_AnnotationEditButtons();
        currentScreen = infoScreens.NONE;
        refreshInfo();

    }

    /**get text content by lines to a given file*/
    private ArrayList loadFileContents(String _absoluteFileName) {
        return commons.Filesys.ReadFileContents(_absoluteFileName);
    }

    /**Load text content from file and show them in textpanel*/
    private void showFileContextInTextPane(int index, int LatestScrollBarValue )
    {
        // ##1 validity check to "selectedIndex"
        // numbers of items in the filelist
        int size = jComboBox_InputFileList.getItemCount();
        if (index > (size - 1))
            return;

        // ##2 get the file you want to show in text pane.
        // To this index, get matched absolute textsourceFilename
        File currentTextSource = env.ClinicalNoteList.CorpusLib.getFile(index);

        // ##2.1 record current operatig file into workset
        WorkSet.setCurrentFile(currentTextSource, index);
        // validity check
        if (currentTextSource == null) return;

        // ##3 Load all text content by lines from this file.
        ArrayList<String> contents = loadFileContents(currentTextSource.getAbsolutePath());
        setDoclength( contents );

        // ##4 SHOW text content on screen and HIGHLIGHT annotations
        ResultEditor.Display.Screen display = new ResultEditor.Display.Screen(
                textPaneforClinicalNotes,
                currentTextSource // text source
                );
        display.ShowTextAndBackgroundHighLight( contents );
    }

    /**Load text content from file and show them in textpanel*/
    private void showFileContextInTextPane(File _current_text_file, int LatestScrollBarValue )
    {
        if (_current_text_file == null) {
            System.out.println("error 1103251356:: fail to find file context");
            return;
        }


        // ##2.1 record current operatig file into workset
        WorkSet.setCurrentFile(_current_text_file);
        // validity check


        // ##3 Load all text content by lines from this file.
        ArrayList<String> contents = loadFileContents(_current_text_file.getAbsolutePath());
        setDoclength( contents );

        // ##4 SHOW text content on screen and HIGHLIGHT annotations
        ResultEditor.Display.Screen display = new ResultEditor.Display.Screen(
                textPaneforClinicalNotes,
                _current_text_file // text source
                );
        display.ShowTextAndBackgroundHighLight( contents );
    }

    private void setDoclength(ArrayList<String> contents){
        if ( contents == null )
            return;

        int length = 0;
        for( String paragraph : contents ){
            if ( paragraph == null )
                continue;
            length = length + paragraph.length() + 1;
        }

        if ( jpositionIndicator == null )
            return;
        jpositionIndicator.setDocLength(length);
    }
    /** if the indicator is "ON"(false), check and correct span border by
     * space or symbols, o.w. use exact span user just selected
     *
     * @param   tp
     *          object of jtextpane that a span just got selected on.
     */
    private void operation_checkBorder_whileNeeded(JTextPane tp){
         UserInterface.CorrectSpanBorder.SpanChecker checker
                 = new UserInterface.CorrectSpanBorder.SpanChecker(tp);
         checker.checkAndCorrect_ifHave();
    }    

    /** By the user disignated textsourceFilename, show its text contents in text area
     */
    public void goUserDesignated()
    {

        textPaneforClinicalNotes.setText(null);
        // ##1##
        // exit from annotation comparison mode if editor panel and comparator
        // panel are showed for comparing annotation conflits
        try{
            ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).setStatusInvisiable();
        }catch(Exception ex){
            System.out.println("error 1012011313:: fail to leave annotations compaison mode!!!");
        }

        resetVerifier();

        try{
            // numbers of items in the filelist
            int size = jComboBox_InputFileList.getItemCount();
            if (size < 1)
                    return;
            int fileListSize = env.ClinicalNoteList.CorpusLib.getSize();

            // use this to avoid the initial loading side effect
            if(size!=fileListSize)
                return;

            int selected = jComboBox_InputFileList.getSelectedIndex();

            if (selected <= (size-1)) {
                ResultEditor.WorkSpace.WorkSet.latestScrollBarValue = 0;
                //jComboBox_InputFileList.setSelectedIndex(selected + 1);
                showFileContextInTextPane(selected, 0);
                this.showAnnotationCategoriesInTreeView_CurrentArticle();
                this.showValidPositionIndicators_setAll();
                this.showValidPositionIndicators();
            } else {
                Toolkit.getDefaultToolkit().beep();
            }
        }catch(Exception ex){
            System.out.println("error 1012011314:: fail to switch to another document!!!");
        }

        // reset details display
        disableAnnotationDisplay();
        disable_AnnotationEditButtons();
        //currentScreen = infoScreens.NONE;
        refreshInfo();
    }


    public void showFirstFile_of_corpus()
    {

        textPaneforClinicalNotes.setText(null);
        // ##1##
        // exit from annotation comparison mode if editor panel and comparator
        // panel are showed for comparing annotation conflits
        try{
            ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).setStatusInvisiable();
        }catch(Exception ex){
            System.out.println("error 1012011313-2:: fail to leave annotations compaison mode!!!");
        }

        resetVerifier();

        try{
            // numbers of items in the filelist
            int size = jComboBox_InputFileList.getItemCount();
            if (size < 1)
                    return;

                ResultEditor.WorkSpace.WorkSet.latestScrollBarValue = 0;

                showFileContextInTextPane(0, 0);

        }catch(Exception ex){
            System.out.println("error 1012011314:: fail to switch to another document!!!");
        }

        // reset details display
        disableAnnotationDisplay();
        disable_AnnotationEditButtons();
        //currentScreen = infoScreens.NONE;
        refreshInfo();
    }


    private void goUserDesignatedTable()
    {
        resetVerifier();
        // numbers of items in the filelist
        int size = this.jList_corpus.getModel().getSize();
        if (size < 1)
                return;
        int fileListSize = env.ClinicalNoteList.CorpusLib.getSize();

        // use this to avoid the initial loading side effect
        if(size!=fileListSize)
            return;

        int selected = this.jList_corpus.getSelectedIndex();

        if (selected <= (size-1)) {
            jComboBox_InputFileList.setSelectedIndex(selected);
            ResultEditor.WorkSpace.WorkSet.latestScrollBarValue = 0;
            //jComboBox_InputFileList.setSelectedIndex(selected + 1);
            showFileContextInTextPane(selected, 0);
            this.showAnnotationCategoriesInTreeView_CurrentArticle();
            this.showValidPositionIndicators_setAll();
            this.showValidPositionIndicators();
        } else {
            Toolkit.getDefaultToolkit().beep();
        }

        // reset details display
        disableAnnotationDisplay();
        disable_AnnotationEditButtons();
        //currentScreen = infoScreens.NONE;
        refreshInfo();
    }
    
    private void restoreDeleted()
    {
        if(WorkSet.getLastDeleted() != null && WorkSet.getCurrentFile().getName().equals(WorkSet.getLastDeletedFilename()))
        {
            Depot depot = new Depot();
            depot.addANewAnnotation(WorkSet.getLastDeletedFilename(), WorkSet.getLastDeleted());
            WorkSet.restoredLastDeleted();
            this.repaintHighlighter();
        }
    }

    /**Load report system form into current tab while user click tab button
     * on eHOST. */
    private void load_ReportSystem(){
        if (jPanel_reportFormContainer == null)
            return;

        int comp_count = jPanel_reportFormContainer.getComponentCount();

        if( comp_count == 0 ){
            // load form components
            //Reports.ReportForm rpform = new Reports.ReportForm();


            graphicsReport.Manager manager = new graphicsReport.Manager(this);

            jPanel_reportFormContainer.setLayout(new BorderLayout());
            jPanel_reportFormContainer.add(manager);
            jPanel_reportFormContainer.setVisible(true);

            //refresh
            jPanel_reportFormContainer.validate();
            jPanel_reportFormContainer.updateUI();
        }


    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Private Methods - Relationships(Simple and Complex)">
    private void addRelationship(int position)
    {
            Depot depot = new Depot();

            //Get all annotations at click position
            Vector<Integer> indices = depot.getSelectedAnnotationIndexes(WorkSet.getCurrentFile().getName(), position, false);
            //if nothing was clicked on simply return
            if(indices.size() == 0)
                return;
            //If something was clicked on then just use the first one on the list...
            //TODO: Might want to expand on this later to allow user to disambiguate multiple
            //selections
            Annotation toSend = depot.getAnnotation(WorkSet.getCurrentFile().getName(), indices.get(0));

            {
                /*
                 * If the relationship already contains an instance of the clicked on annotation then
                 * remove it, otherwise add it to the list
                 */
                {
                    //If this is a new ComplexRelationship then add a new complex relationship to the annotation
                    if(addingTo == null)
                        addingTo = WorkSet.currentAnnotation.addComplex("", toSend);
                    //If it's not a new relationship then modify the currently selected one
                    else
                    {
                        //If the Relationship already existed try to remove the Annotation
                        //that was left clicked
                        Vector<eComplex> complexes = addingTo.getLinkedAnnotations();
                        boolean removed = false;
                        for(int i = 0; i < complexes.size(); i++)
                        {
                            eComplex complex = complexes.get(i);
                            if(complex.mention.equals(toSend.mentionid))
                            {
                                complexes.remove(i);
                                removed = true;
                                i--;
                            }
                        }
                        //If nothing was removed, then this is new to the relationship
                        //so add it.
                        if(!removed)
                            addingTo.addLinked(new eComplex(toSend));
                    }
                }
                //See if the selected annotations have markable classes inside of the
                //current relationship schema
                ArrayList<String> classes = new ArrayList<String>();

                //Build Arraylist of classes to check
                classes.add(WorkSet.currentAnnotation.annotationclass);
                for(eComplex complex : addingTo.linkedAnnotations)
                {
                    classes.add(complex.annotationClass);
                }
                //Get the name of the matching relationship(returns null if nothing matches).
                String name = env.Parameters.ComplexRelationshipNames.getNameByRegex(classes);

                //If name is non-null then name the relationship, else clear out the name.
                if(name!= null)
                {
                    addingTo.setMentionSlotID(name);
                }
                else
                {
                    addingTo.setMentionSlotID("");
                }
            }

            // refresh display after modification
            // showSelectedAnnotations_inList(0);
            this.display_showAnnotationDetail_onEditorPanel(WorkSet.currentAnnotation);
            showSelectedAnnotations_inList(0);
            //this.hilightPhrase(WorkSet.currentAnnotation);

            return;
    }
    private boolean stopRelationshiping()
    {
        //validRel.setText("");
            //jComboBox1.setBackground(Color.white);
            if(addingTo != null)
            {
                //See if the selected annotations have markable classes inside of the
                //current relationship schema
                ArrayList<String> classes = new ArrayList<String>();
                classes.add(WorkSet.currentAnnotation.annotationclass);
                for(eComplex complex : addingTo.linkedAnnotations)
                {
                    classes.add(complex.annotationClass);
                }
                String name = env.Parameters.ComplexRelationshipNames.getNameByRegex(classes);
                if(name!= null)
                {
                    addingTo.setMentionSlotID(name);
                }
                else
                {
                    Toolkit.getDefaultToolkit().beep();
                    WorkSet.currentAnnotation.ComplexRelationships.remove(addingTo);
                }
                addingTo=null;
                //We may have modified the relationship so refresh information
                this.display_showAnnotationDetail_onEditorPanel(WorkSet.currentAnnotation);
                showSelectedAnnotations_inList(0);
                return true;
            }
            addingTo = null;
            return false;
    }
    /** display normalrelationships information of current annotation*/
    private void displayRelationships( final ResultEditor.Annotations.Annotation annotation ) {

        //####-1-   show normal relationships
        if ( annotation.normalrelationships == null ){
            Vector empty = new Vector();
            jList_normalrelationship.setListData(empty);
            //jLabel_typeOfRelationship.setText("Type of normalrelationships: ");
        } else {
            //jLabel_typeOfRelationship.setText("Type of normalrelationships: ");
            Vector<String> list = new Vector<String>();
            for( ResultEditor.Annotations.NormalRelationship normalrelationship : annotation.normalrelationships ){
                if (normalrelationship == null) continue;
                for(String stringslotvalue: normalrelationship.relationshipValue){
                    String str;
                    if( stringslotvalue != null ) {
                        str = " \"" + normalrelationship.relationshipName + "\" = " + stringslotvalue;
                    } else {
                        str = " \"" + normalrelationship.relationshipName + "\"";
                    }
                    list.add(str);
                }
            }
            jList_normalrelationship.setListData( list );
        }


        //####-2-   show complex relationships
        if ( annotation.ComplexRelationships == null ){
            Vector cempty = new Vector();
            jList_complexrelationships.setListData(cempty);
        } else {
            //jLabel_typeOfRelationship.setText("Type of normalrelationships: ");
            Vector<iListEntry> clist = new Vector<iListEntry>();
            for( ResultEditor.Annotations.ComplexRelationship relationship : annotation.ComplexRelationships ){
                if (relationship == null) continue;
                clist.add(new iListEntry(relationship));
                /*
                for(ResultEditor.Annotations.eComplex linkedannotationtext : relationship.getLinkedAnnotations() ){
                    String str = " \"" + relationship.getMentionSlotID() + "\" = " + linkedannotationtext.linkedAnnotationText ;
                    clist.add(str);
                }
                 *
                 */
            }
            jList_complexrelationships.setListData( clist );
            jList_complexrelationships.setCellRenderer(new iListCellRenderer());
        }
    }
    private void openRelationshipViewer()
    {
        Vector<iListable> listable = new Vector<iListable>();
        if(WorkSet.currentAnnotation == null)
            return;
        if(WorkSet.currentAnnotation.ComplexRelationships!= null)
        {
            for(ComplexRelationship f: WorkSet.currentAnnotation.ComplexRelationships)
            {
                listable.add(f);
            }
        }
        if(editor == null || !editor.isVisible())
        {
            editor =  new ResultEditor.ComplexRelationship.Editor(this, listable, ResultEditor.ComplexRelationship.Editor.Type.ComplexRelationships);
            editor.setVisible(true);
        }
    }
    private void relationshipStuffChanged()
    {
        if(this.jList_complexrelationships.getSelectedIndex() >= 0)
        {
            //if(WorkSet.makingRelationships)
                this.edit_Relationships.setEnabled(true);
//            else
            //    this.edit_Relationships.setEnabled(false);
            delete_Relationships.setEnabled(true);
        }
        else
        {
            edit_Relationships.setEnabled(false);
            delete_Relationships.setEnabled(false);
        }
    }

    private void openAttributeEditor()
    {
        
        if (WorkSet.currentAnnotation == null)
        {
            return;
        }
        Vector<iListable> finalList = WorkSet.currentAnnotation.getNormalRelationshipsForShow();

        if(editor == null || !editor.isVisible())
        {
            editor = new ResultEditor.ComplexRelationship.Editor(this, finalList, ResultEditor.ComplexRelationship.Editor.Type.Attributes);

            editor.setVisible(true);
        }
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Private Methods - Verifier">
    private void setToVerifier()
    {
        infoList.setListData(verifierAnnotations);
        jLabel29.setText("Verifier");
        currentScreen = infoScreens.VERIFIER;
    }
    private void resetVerifier()
    {
        WorkSet.currentlyViewing = new ArrayList<Integer>();
        WorkSet.filteredViewing = false;
    }
    /**
     * This method will fill member variables with the potential problems as flagged by the
     * Verifier using the current verifier dictionaries and settings.
     */
    private void callVerifierWithCurrent()
    {
        //Make sure verifier dictionaries are loaded.
        Dictionaries.VerifierDictionaries.loadPreAnnotatedConcepts();
        FLAG_MAYBE_CHANGED = false;
        Verifier.SpanCheck spanCheck = new Verifier.SpanCheck(
                env.ClinicalNoteList.CorpusLib.getAbsoluteFileName(jComboBox_InputFileList.getSelectedIndex()), env.Parameters.VERIFIER_DICTIONARIES);
        spanCheck.findProblems(-1);
    }
    private void callVerifierWithAll()
    {
        Dictionaries.VerifierDictionaries.loadPreAnnotatedConcepts();
        for(File file: WorkSet.getAllTextFile())
        {
            FLAG_MAYBE_CHANGED = false;
            Verifier.SpanCheck spanCheck = new Verifier.SpanCheck(
                file.getAbsolutePath(), env.Parameters.VERIFIER_DICTIONARIES);
            spanCheck.findProblems(-1);
        }
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Private Methods - Preannotate Tab">
    
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Private Methods - Information Tab">
    private void setToClassConflict() {
        Vector<classConflict> conflicts = new Vector<classConflict>();
        conflicts.addAll(conflictWithWorking);
        infoList.setListData(conflicts);
        jLabel29.setText("Class Conflicts");
        currentScreen = infoScreens.CLASSCONFLICT;
    }
    private void setToAnnotators()
    {
        //Set to Annotators
        Vector<String> theAnnotators = new Vector<String>();
        theAnnotators.addAll(annotatorsList);
        infoList.setListData(theAnnotators);
        jLabel29.setText("Annotator");
        currentScreen = infoScreens.ANNOTATORS;
    }
    /*
     * This should be called when the user has double clicked on an annotator in
     * the annotations information tab, this will display the Annotations with annotators
     * matching the chosen annotator.
     */
    private void selectAnAnnotator()
    {

        Vector<Annotation> toDisplay = new Vector<Annotation>();

        //Get the selected annotator
        String selectedAnnotator = (String)infoList.getSelectedValue();

        //find annotations with matching annotators.
        for(Annotation annotation: annotationsList)
        {
            if(annotation.annotator.equals(selectedAnnotator))
                toDisplay.add(annotation);
        }

        //alphabetize and display
        Collections.sort(toDisplay);
        infoList.setListData(toDisplay);
        jLabel29.setText(selectedAnnotator);
    }
    private JFileChooser setFileChooserAttributes(fileInputType type){
        // if the filechooser was used for
        if (type == fileInputType.importXMLandPin ){
            JFileChooser jFileChooser2 = new JFileChooser();
            jFileChooser2.setDialogType( JFileChooser.OPEN_DIALOG);
            jFileChooser2.setFileSelectionMode(0);
            jFileChooser2.setMultiSelectionEnabled(true);
            jFileChooser2.setDialogTitle("import annotation from XML files:");
            String[] all = new String[] { "" };
            String[] xmlpin = new String[] { "pins", "xml" };

            int size = jFileChooser2.getChoosableFileFilters().length;
            javax.swing.filechooser.FileFilter[] filefilters = jFileChooser2.getChoosableFileFilters();

            for (int i = 0; i < filefilters.length; i++) {
               jFileChooser2.removeChoosableFileFilter(filefilters[i]);
            }


            jFileChooser2.addChoosableFileFilter(new commons.SimpleFileFilter(all,
                "All files (*.*)"));
            jFileChooser2.addChoosableFileFilter(new commons.SimpleFileFilter(xmlpin,
                "XML and PINS annotation files (*.xml, *.pins)"));

            // set dafault folder is latest accessed folder
            jFileChooser2.setCurrentDirectory( recentlyOpennedFolder );


            return jFileChooser2;

        }else if (type ==  fileInputType.selectClinicalTextFiles ){
            // show file dialog to select clinical notes
            // select file, not directory
            jFileChooser1.setDialogType(1);
            jFileChooser1.setFileSelectionMode(0);
            jFileChooser1.setMultiSelectionEnabled(true);
            jFileChooser1.setDialogTitle("Please Choose Clinical Notes(Text):");
            String[] all = new String[] { "" };
            String[] text = new String[] { "txt" };


            javax.swing.filechooser.FileFilter[] filefilters = jFileChooser1.getChoosableFileFilters();

            for (int i = 0; i < filefilters.length; i++) {
               jFileChooser1.removeChoosableFileFilter(filefilters[i]);
            }


            jFileChooser1.addChoosableFileFilter(new commons.SimpleFileFilter(all,
                "All files (*.*)"));
            jFileChooser1.addChoosableFileFilter(new commons.SimpleFileFilter(text,
                "text file (*.txt)"));
            return null;

        }else if(type ==  fileInputType.setXmlOutputforConcepts){
            // prepare the file chooser
            jFileChooser1.setDialogType(1);

            jFileChooser1.setDialogType(JFileChooser.OPEN_DIALOG);
            jFileChooser1.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            jFileChooser1.setSelectedFile(null);
            jFileChooser1.setCurrentDirectory(null);
            File f = jFileChooser1.getSelectedFile();

            // try to remove file name from previous operation, maybe the
            // text file selecting operation.
            try{
                if (f!=null)
                    jFileChooser1.setSelectedFile(new File(f.getPath()));
            }catch(Exception ex){
                System.out.println("Warning 1009091503: fail to set path.");
            }

            jFileChooser1.setMultiSelectionEnabled(false);
            jFileChooser1.setDialogTitle("Chooser folder to ouput annotations:");
            javax.swing.filechooser.FileFilter[] filefilters = jFileChooser1.getChoosableFileFilters();

            for (int i = 0; i < filefilters.length; i++) {
               jFileChooser1.removeChoosableFileFilter(filefilters[i]);
            }
            return null;
        }
        return null;
    }
    /**
     * This function should be called when the classes should be displayed
     * in the list of information in the Annotation information tab.
     */
    private void setToClasses()
    {
        //To store the classes in.
        Vector<String> theClasses = new Vector<String>();

        //Add all of the classes from the classes list.
        theClasses.addAll(classesList);

        //Keep track of how many times each class occurs
        ArrayList<Integer> counts = new ArrayList<Integer>();

        //Start each count at 0.
        for(int i = 0; i < theClasses.size(); i++)
            counts.add(0);

        //Go through all of the annotations, and count the number of classes
        for(Annotation annotation: annotationsList)
        {
            //Check to see which class the Annotation matches and count it.
            for(int i = 0; i< theClasses.size(); i++)
            {
                //If it matches this class then increment the coresponding count
                if(theClasses.get(i).equals(annotation.annotationclass))
                {
                    counts.set(i, counts.get(i)+1);
                }
            }
        }
        //Build the string to display
        for(int i =0 ; i< theClasses.size(); i++)
        {
            theClasses.set(i, "<html>Class Name: " + theClasses.get(i) + " <br><font color = \"gray\">Count in File: " + counts.get(i) + "</font></html>");
        }
        //put it in alphabetical order
        Collections.sort(theClasses);

        //Set the list data
        infoList.setListData(theClasses);

        //Indicate that we're viewing classes
        jLabel29.setText("Class");

        //Set the current screen to classes
        currentScreen = infoScreens.CLASSES;
    }
    /**
     * This function should be called to set the info list in the annotations tab
     * to the list of all annotations.
     */
    private void setToAnnotations()
    {
        //Will contain all of the anotations
        Vector<Annotation> v = new Vector<Annotation>();

        //Loop through all of the annotations to add them to the Vector.
        for(int firstPass = 0; firstPass < annotationsList.size(); firstPass++)
        {
            v.add(annotationsList.get(firstPass));
        }
        //sort the list so it's in alphabetical order
        Collections.sort(v);

        //display the annotation
        infoList.setListData(v);

        //We're viewing annotations
        jLabel29.setText("Annotation");
        currentScreen = infoScreens.ANNOTATIONS;
    }

    public void refreshInfo()
    {
        //jLabel29.setText("");
        classesList = new HashSet<String>();
        annotatorsList = new HashSet<String>();
        annotationsList = new Vector<Annotation>();
        conflictWithWorking = new Vector<classConflict>();
        verifierAnnotations = new Vector<Annotation>();
        Depot depot = new Depot();
        WorkSet.getCurrentFileIndex();
        File current = WorkSet.getCurrentFile();
        if (current != null)
        {
            Article article = depot.getArticleByFilename(current.getName());
            if(article == null)
            {
                //If article is null then just clear out the results
                annotations.setText("<html>" + annotationsText + "</html>");
                classes.setText("<html>" + classesText + "</html>");
                annotators.setText("<html>" + annotatorsText + "</html>");
                workingConflicts.setText("<html>" + conflictsText + "</html>");
                overlapping.setText("<html>" + overlappingText +"</html>");
                verifierFlagged.setText("<html>" + verifierText + "</html>");
                currentScreen = infoScreens.NONE;
                reDrawInfoList();
                return;
            }

            //Get all of the annotations
            annotationsList = article.annotations;
            //Loop through all annotations to get data
            for (Annotation annotation : annotationsList)
            {
                //Capture all classes and annotators
                classesList.add(annotation.annotationclass);
                annotatorsList.add(annotation.annotator);

                //If the annotation has Verifier information then capture that as well
                if((annotation.verifierFound != null && annotation.verifierFound.size() > 0) || annotation.isVerified())
                {
                    verifierAnnotations.add(annotation);
                }
            }

            //Update tab with new information
            overlappingAnnotations = tmp_Conflicts.getSpanConflicts(current.getName());
            conflictWithWorking = tmp_Conflicts.getClassConflicts(current.getName());
            annotations.setText("<html>" + annotationsText + "<font color = \"blue\">" + annotationsList.size() + "</font></html>");
            classes.setText("<html>" + classesText + "<font color = \"blue\">" + classesList.size() + "</font></html>");
            annotators.setText("<html>" + annotatorsText + "<font color = \"blue\">" + annotatorsList.size() + "</font></html>");
            workingConflicts.setText("<html>" + conflictsText + "<font color = \"blue\">" + conflictWithWorking.size() + "</font></html>");
            overlapping.setText("<html>" + overlappingText + "<font color = \"blue\">" + overlappingAnnotations.size() + "</font></html>");
            verifierFlagged.setText("<html>" + verifierText + "<font color = \"blue\">" + verifierAnnotations.size() + "</font></html>");
        }

        reDrawInfoList();
    }

    /**
     * Should be called whenever the infoList needs to be redrawn.
     * currentScreen variable must be set correctly for this to work.
     */
    private void reDrawInfoList()
    {

        switch(currentScreen)
        {
            case ANNOTATIONS:
                setToAnnotations();
                break;
            case ANNOTATORS:
                setToAnnotators();
                break;
            case CLASSCONFLICT:
                setToClassConflict();
                break;
            case NONE:
                infoList.setListData(new Vector());
                break;
            case SPANCONFLICT:
                setToSpanConflict();
                break;
            case CLASSES:
                setToClasses();
                break;
            case VERIFIER:
                setToVerifier();
                break;
        }
    }

    /**
     * Set annotation information list to view spanConflicts.
     */
    private void setToSpanConflict()
    {
        Vector<spanOverlaps> conflicts = new Vector<spanOverlaps>();
        conflicts.addAll(this.overlappingAnnotations);
        infoList.setListData(conflicts);
        jLabel29.setText("Overlapping Annotations");
        currentScreen = infoScreens.SPANCONFLICT;
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Private Methods - Importing Annotations">
    /**Import annotations from XML or PIN files and show on screen.<p>
     * #1 show file chooser to let users select XML or PINS files.<p>
     * #2 (subfunction)extract annotation from pin or xml files.<p>
     * #3 (subfunction)show imported annotation on screen.
     */
    public void importAnnotations() {

        // set file chooser
        JFileChooser filechooser = setFileChooserAttributes( fileInputType.importXMLandPin );

        // ## 1.1 ## - show dialog of filechooser
        int re = filechooser.showOpenDialog(this);
        if (re != 0) return;

        // ## 1.2 ## - get selected files (pins and xml files)
        File[] files = filechooser.getSelectedFiles();
        if ( files == null ) return;
        if ( files.length < 1 ) return;

        // if choosed file(s)
        int loops = files.length;
        int size_InputedClinicalNotes = env.ClinicalNoteList.CorpusLib.getSize();


        // to all selected files to import, let's get knowtator xml files whose filenames are
        // appeared in the list of text sources after string ".knowtator.xml" removed
        Vector matchedAnnotationFiles = new Vector();
        for (int i = 0; i < loops; i++) {
            // get each xml file in the list
            String filename = files[i].getName();
            for (int j = 0; j < size_InputedClinicalNotes; j++) {
                filename = filename.trim().toLowerCase();

                // get textsourceFilename of each imported clinical notes
                String inputfilename = env.ClinicalNoteList.CorpusLib.getFileName(j);
                String inputfilename2 = inputfilename.substring(0,inputfilename.length()-4) +".knowtator.xml";
                inputfilename = (inputfilename + ".knowtator.xml").trim().toLowerCase();

                // than we can compare them, and record matched annotation xml file
                if (filename.compareTo(inputfilename) == 0 || filename.compareTo(inputfilename2) == 0)
                    matchedAnnotationFiles.addElement(files[i]);
            }
        }



        // #3.1 extract annotations from XML files
        extractAnnotation_fromXML( matchedAnnotationFiles );

        // #4.1 get all PIN files from just selected files
        // #4.2 extract annotations from PIN files
        int count = extractAnnotation_fromPINS( files );

        //Get the annotations that we just added.
        Depot depot = new Depot();
        Vector<Annotation> newOnes = new Vector<Annotation>();
        for(Annotation annotation: depot.getAllAnnotations()) {
            if(!annotation.isVerified())
                newOnes.add(annotation);
        }

        //Create Sets for new attributes and relationships
        TreeSet<Attribute> newAttributes = new TreeSet<Attribute>();
        TreeSet<String> newRelationships = new TreeSet<String>();

        //Find Attributes which are outside our schema
        newAttributes.addAll(env.Parameters.SimpleRelationshipNames.checkExists(newOnes));

        //Create list of unique unknown relationships
        TreeSet<ComplexRelImportReturn> temp = new TreeSet<ComplexRelImportReturn>();
        temp.addAll(env.Parameters.ComplexRelationshipNames.checkUniqueRegex());

        //Set annotations visible
        setAnnotationVisible();

        // show clinical notes in color
        int selected = jComboBox_InputFileList.getSelectedIndex();
        showFileContextInTextPane(selected, 0);
        //If unknown attributes or relationships were inputted then open an import schema handler
        if(( newAttributes.size() >0 || temp.size() > 0 )
            && env.Parameters.AnnotationImportSetting.needSchemaHandler )
        {
            WrapperForBoth wrapper = new WrapperForBoth(newAttributes, temp, this, loops + " file(s) selected: "
                    + (matchedAnnotationFiles.size()+ count)
                    + " file(s) imported for matching text files.");
            wrapper.doImportForBoth();
        }
        //If no unknown attributes/relatinships just show a message indicating how many files inputted.
        else
        {
            // show messagebox to tell how many matched xml file got important
            Toolkit.getDefaultToolkit().beep();
            JOptionPane.showMessageDialog(this, loops + " file(s) selected: "
                    + (matchedAnnotationFiles.size()+ count)
                    + " file(s) imported for matching text files.");
            //500 file(s) selected: 3 file(s) imported for matching text files.
        }


    }
    /**
     * Extract annotations from Protege Knowtator pins file.
     *
     * @param   files
     *          the designated PINS files.
     *
     * @return  ***TODOTODO::need recheck the return value***
     */
    private int extractAnnotation_fromPINS(File[] files){
        // ##1 get all PIN files from just selected files
        File[] pinFiles = getPinFiles( files );
        // ##2 extract annotations from PIN files
        int count = 0;
        if( pinFiles != null ){
            ResultEditor.IO.Extractor extractor = new ResultEditor.IO.Extractor();
            extractor.fromPINSfiles( pinFiles );
            count = pinFiles.length;
        }
        return count;
    }
    /**Find and return all pin files from a given file array.
     * @return all found pin files which got from param "files".
     * @param  files - all files.
     */
    private File[] getPinFiles(final File[] files){
        Vector<File> resultFiles = new Vector<File>();

        // #1. get files with suffix name ".pins"
        for(int i=0; i< files.length; i++ ) {
            if (files[i] == null) continue; // validity check
            // search for ".pin" suffix
            if ( files[i].getName().toLowerCase().contains(".pins") ) {
                resultFiles.add(files[i]);
            }
        }

        // #2. build return array in format of "File[] "
        int size = resultFiles.size();
        if(size == 0)
            return null;

        File[] results = new File[size];
        for(int i=0;i<size; i++) {
            if ( resultFiles.get(i) instanceof File )
                results[i] = resultFiles.get(i);
        }
        return results;
    }


    /**load XML files and then extract annotations from them.
     * @param   XMLFiles
     */
    private void extractAnnotation_fromXML(Vector XMLFiles) {
        // ##0## record file information about all imported xml files
        try{
            if(XMLFiles==null)
                return;

            for(File f: (Vector<File>) XMLFiles){
                if(f==null)
                    continue;
                if(f instanceof File) {
                    env.Parameters.AnnotationsImportingCorrelated.allImportedXMLs.add(f);
                    //System.out.println("xml annotation file name and path saved! -" + f.toString() );
                }
            }

        }catch(Exception ex){}

        // ##1## start annotation extraction
        ResultEditor.Annotations.ImportAnnotation imports = new
                ResultEditor.Annotations.ImportAnnotation();
        imports.XMLImporter(XMLFiles);

    }



    private void cleanImportedXMLBufferAndReload() {
        try{

            // saved file list which contains all file information of imported
            // xml annotation files
            env.Parameters.AnnotationsImportingCorrelated.allImportedXMLs.clear();

            //
            ResultEditor.Annotations.Depot depot = new ResultEditor.Annotations.Depot();
            depot.clear();
            int caretpostion = textPaneforClinicalNotes.getCaretPosition();
            int selected = jComboBox_InputFileList.getSelectedIndex();
            showFileContextInTextPane(selected, 0);
            //textPaneforClinicalNotes.setCaretPosition(caretpostion);
        }catch(Exception ex){
            System.out.println("error 1101012338::"+ex.toString());
        }
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Private Methods - Tab Management">
    /**Enter different tab by user's selection
     * @param _tab  show which tab user is expecting for<p>
     *      type is enum <code>tabs</code>{<p>
     *          creationAnnotation, resulteditor, dictionariesSetting,<p>
     *          pinExtractor, dictionariesManager, exit<p>
     *      };<p>
     */
    public void tabDoorman(TabGuard.tabs _tab)
    {

        // set right button selected
        TabGuard.tabs tab = TabGuard.getLatestActivedTab();
        if((_tab == TabGuard.tabs.exit)||
                (_tab== TabGuard.tabs.dictionariesSetting) ){
            // selected button matched to previous tab
            setTabButton(tab);
            setButtonSelected(tab);
        }else{
            // set status of buttons
            setTabButton(_tab);
            // this actived tab
            TabGuard.justActivedTab(_tab);
        }



        // enter different tab by user's selection
        switch(_tab){
            // enter tab to annotate documents by running NLP with pre-annotated
            // dictinary, regular expressions, etc
            case creationAnnotation:
                enterTab_createAnnotaion();
                break;

            // enter tab of result editor
            case resulteditor:
                enterTab_ResultEditor();
                break;

            // enter tab for dictionary setting
            case dictionariesSetting:
                // show dictionaries setting dialog
                show_dialog_of_preference_to_manage_dictionaries();
                break;

            // enter tab of pin extractor
            case pinExtractor:
                enterTab_pinExtractor();
                break;

            // show dialog of dictionaries manager
            case dictionariesManager:
                //preAnnotate.DictionaryGUI.main(null);
                enterTab_createDictionary();
                break;
                
            // show assignement screen for Chart Readerd
            case assignmentsScreen:
                enterTab_assignmentsScreen();
                break;
                
            case converter:
                enterTab_converter();
                break;

            // show confirmation window before closing whole application
            case exit:
                //Show dialog of exit confirmation.
                showExitConfirmDialog();
                break;
        }
    }


    // selected button matched to previous tab
    private void setTabButton(TabGuard.tabs _tab){
        // norma
        Font f = new Font("Arial", Font.BOLD, 12);
        java.awt.Color c = new java.awt.Color(0,102,102);

        // selected
        Font F = new Font("Arial", Font.BOLD, 13);
        java.awt.Color C = new java.awt.Color(41, 41, 41);

        // set font of buttons on tools bar
        jToggleButton_CreateAnnotaion.setForeground(
                _tab == TabGuard.tabs.creationAnnotation ? C:c);
        jToggleButton_CreateAnnotaion.setFont(
                _tab == TabGuard.tabs.creationAnnotation ? F:f);

        jToggleButton_ResultEditor.setForeground(
                _tab == TabGuard.tabs.resulteditor ? C:c);
        jToggleButton_ResultEditor.setFont(
                _tab == TabGuard.tabs.resulteditor ? F:f);

        jToggleButton_PinExtractor.setForeground(
                _tab == TabGuard.tabs.pinExtractor ? C:c);
        jToggleButton_PinExtractor.setFont(
                _tab == TabGuard.tabs.pinExtractor ? F:f);

        jToggleButton_Converter.setForeground(
                _tab == TabGuard.tabs.converter ? C:c);
        jToggleButton_Converter.setFont(
                _tab == TabGuard.tabs.converter ? F:f);

        jToggleButton_DictionaryManager.setForeground(
                _tab == TabGuard.tabs.dictionariesManager ? C:c);
        jToggleButton_DictionaryManager.setFont(
                _tab == TabGuard.tabs.dictionariesManager ? F:f);

        jToggleButton_DictionarySetting.setForeground(
                _tab == TabGuard.tabs.dictionariesSetting ? C:c);
        jToggleButton_DictionarySetting.setFont(
                _tab == TabGuard.tabs.dictionariesSetting ? F:f);


        jToggleButton_exit.setFont(
                _tab == TabGuard.tabs.exit ? F:f);

    }
    /**reenabled these button we just used before open a new
     * dialog and current frame lost focus.*/
    private void setButtonSelected(TabGuard.tabs _tab ){
        switch(_tab){
            case creationAnnotation:
                jToggleButton_CreateAnnotaion.setSelected(true);
                break;
            case resulteditor:
                jToggleButton_ResultEditor.setSelected(true);
                break;
            case pinExtractor:
                jToggleButton_PinExtractor.setSelected(true);
                break;
            case converter:
                jToggleButton_Converter.setSelected(true);
                break;
            case dictionariesManager:
                jToggleButton_DictionaryManager.setSelected(true);
                break;
        }
    }

    /* load all cardlayout panels */
    private void resetCardLayout(){
        GUIContainer.removeAll();
        GUIContainer.add(JPanel_PinsExtractor, "PinsExtractor");
        GUIContainer.add(jPanel_NLP, "CreateAnnotaion");
        GUIContainer.add(Editor, "InteractiveEditor");

    }
    /**user clicked button to active tab of pin extractor*/
    private void enterTab_pinExtractor(){

        if(!pinsExtractorExisted())
            GUIContainer.add(new preAnnotate.integratedPinsExtractor(), "pinsExtractor");
        // load tab of result editor
        CardLayout card = (CardLayout) GUIContainer.getLayout();
        card.show( GUIContainer, "pinsExtractor");
    }

    /**user clicked button to active tab of FileConverterGUI*/
    private void enterTab_converter(){

        if(!converterExisted())
            GUIContainer.add(new converter.FileConverterGUI(), "converter");
        // load tab of result editor
        CardLayout card = (CardLayout) GUIContainer.getLayout();
        card.show( GUIContainer, "converter");
    }



    /**GUI: enter tab of result editor*/
    private void enterTab_ResultEditor()
    {
                    
        jCardcontainer_interactive.removeAll();
        jCardcontainer_interactive.add(jSplitPane_between_viewer_and_allatttibutes, "resulteditor");
        CardLayout card2 = (CardLayout) jCardcontainer_interactive.getLayout();
        card2.show( jCardcontainer_interactive, "resulteditor");
                         
        jCardcontainer_interactive.validate();
        jCardcontainer_interactive.repaint();
        jCardcontainer_interactive.updateUI();

        // load tab of result editor
        GUIContainer.removeAll();
        GUIContainer.add("InteractiveEditor", Editor );
        CardLayout card = (CardLayout) GUIContainer.getLayout();
        card.show( GUIContainer, "InteractiveEditor");


        // clear possible contents of terms
        

        // set most text filed to uneditable
        jTextField_spanLocation.setEnabled(false);
        jTextField_annotator.setEnabled(false);
        jTextField_creationdate.setEnabled(false);
        
        // disable buttons for span and class edit
        
        disableAnnotationDisplay();
        disable_AnnotationEditButtons();

                
        enter_Interactive();
        addPositionIndicator();         
         
    }



    /**GUI: enter tab of creation annotaion*/
    public void enterTab_createAnnotaion(){

        // read enverionment values       
        config.system.SysConf.loadSystemConfigure();

        // load tab of creation annotation
        // load tab of result editor
        //if(env.Parameters.WorkSpace.CurrentProject==null){
        //    GUIContainer.setVisible(false);
        //    return;
        //}

        GUIContainer.removeAll();
        GUIContainer.add("InteractiveEditor", Editor );
        CardLayout card = (CardLayout) GUIContainer.getLayout();
        card.show( GUIContainer, "InteractiveEditor");

        // show the nlp panel if a project has been selected
        jCardcontainer_interactive.removeAll();
        //if(env.Parameters.WorkSpace.CurrentProject!=null)
        //{
        if(NLPAnnotationPanel==null){
            NLPAnnotationPanel = new annotate.gui.NLPAnnotator(this);
            
        }
            //jCardcontainer_interactive.add(jPanel_NLP, "CreateAnnotaion");
            jCardcontainer_interactive.add(NLPAnnotationPanel, "CreateAnnotaion");
            CardLayout card2 = (CardLayout) jCardcontainer_interactive.getLayout();
            card2.show( jCardcontainer_interactive, "CreateAnnotaion");
        

        jCardcontainer_interactive.validate();
        jCardcontainer_interactive.repaint();
        jCardcontainer_interactive.updateUI();
        


    }

    public Rectangle getRectofCardHolder(){
        Rectangle rect = new Rectangle();
        rect.x = jCardcontainer_interactive.getLocationOnScreen().x;
        rect.y  = jCardcontainer_interactive.getLocationOnScreen().x;
        rect.width = jCardcontainer_interactive.getWidth();
        rect.height = jCardcontainer_interactive.getHeight();
        
        return rect;

    }

    /**GUI: enter tab of creation annotaion*/
    public void enterTab_createAnnotaion_step2()
    {


        // show the nlp panel if a project has been selected
        jCardcontainer_interactive.removeAll();
        //if(env.Parameters.WorkSpace.CurrentProject!=null)
        //{
        if(nlpcpu==null){
            nlpcpu = new annotate.gui.NLPcpu(this);

        }
            //jCardcontainer_interactive.add(jPanel_NLP, "CreateAnnotaion");
            jCardcontainer_interactive.add(nlpcpu, "beginNLP");
            CardLayout card2 = (CardLayout) jCardcontainer_interactive.getLayout();
            card2.show( jCardcontainer_interactive, "beginNLP");


        jCardcontainer_interactive.validate();
        jCardcontainer_interactive.repaint();
        jCardcontainer_interactive.updateUI();

        env.Parameters.NLPAssistant.STOPSign = false;
        nlpcpu.start();


    }

    private void enterTab_createDictionary()
    {
        if(!isComponentExisted())
            GUIContainer.add(new preAnnotate.integratedDictionary(), "dictionary");
        // load tab of result editor
        CardLayout card = (CardLayout) GUIContainer.getLayout();
        card.show( GUIContainer, "dictionary");
    }


    /**check existing of component in MainPanel.
     * @return  false   if this component has not been added.
     * @return  true    if this component has existed in MainPanel.
     */
    private boolean isComponentExisted(){
        int size = GUIContainer.getComponentCount();
        for(int i=0;i<size;i++){
            Component comp = GUIContainer.getComponent(i);

            if( comp instanceof preAnnotate.integratedDictionary )
                return true;
        }
        return false;
    }

    /**check existing of component in MainPanel.
     * @return  false   if this component has not been added.
     * @return  true    if this component has existed in MainPanel.
     */
        private boolean pinsExtractorExisted(){
        int size = GUIContainer.getComponentCount();
        for(int i=0;i<size;i++){
            Component comp = GUIContainer.getComponent(i);

            if( comp instanceof preAnnotate.integratedPinsExtractor )
                return true;
        }
        return false;
    }
        /**check existing of component in MainPanel.
     * @return  false   if this component has not been added.
     * @return  true    if this component has existed in MainPanel.
     */
        private boolean converterExisted(){
        int size = GUIContainer.getComponentCount();
        for(int i=0;i<size;i++){
            Component comp = GUIContainer.getComponent(i);

            if( comp instanceof converter.FileConverterGUI )
                return true;
        }
        return false;
    }
        
    private void enterTab_assignmentsScreen()
    {
        switchToComponent(AssignmentsScreen.class, "Assignments");
    }
    
    private void switchToComponent(Class componentClass, String label) 
    {
        if (!hasComponent(componentClass)) {
            try {
                GUIContainer.add( (Container) componentClass.newInstance(), label);
            } catch (Exception e) {
                // TODO: inform a developer
                // for now ignore the error
                return;
            }
        }
        CardLayout card = (CardLayout) GUIContainer.getLayout();
        card.show( GUIContainer, label);
    }
    
    private boolean hasComponent(Class componentClass) 
    {    
        int size = GUIContainer.getComponentCount();
        for (int i=0; i<size; i++) {
            Component component = GUIContainer.getComponent(i);
            if (componentClass.isInstance(component))
                return true;                
        }
        return false;
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Private Class TabGuard">
    
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Event Handling Methods">
    private void setRelationshipingEnabled(boolean set)
    {
        jButton9.setSelected(set);
        WorkSet.makingRelationships = jButton9.isSelected();
        if(!jButton9.isSelected())
        {
            jButton9.setToolTipText("Enable relationship building");
            stopRelationshiping();
        }
        else
        {
            jButton9.setToolTipText("Disable relationship building");
        }
        relationshipStuffChanged();
    }
    /**
     * Handling mouse clicked event: mouse click on the text area and it may
     * (1)select one annotation or (2)select some text that we can build
     * new annotation.
     *
     * @param   evt
     *          Caught system mouse event.
     */
    private void mouseClickOnTextPane(java.awt.event.MouseEvent evt){

        // filename of current document
        String textsourceFilename = ResultEditor.WorkSpace.WorkSet.getCurrentFile().getName();
        /**get position of mouse and use it to find matched annotation information*/
        int position = textPaneforClinicalNotes.viewToModel(evt.getPoint());
        // try to use current mouse carpet position to select annotations
        //ResultEditor.Annotations.Depot depot = new ResultEditor.Annotations.Depot();
        //Vector<Integer> selectedAnnotationIndexes = depot.getSelectedAnnotationIndexes( textsourceFilename, position, true );
        Vector<Annotation> selectedAnnotaions =
           ResultEditor.Annotations.Depot.SelectedAnnotationSet.selectAnnotations_ByPosition(
                textsourceFilename, position, false
           );

        boolean leftClick = evt.getButton() == MouseEvent.BUTTON1;
        boolean rightClick = evt.getButton() == MouseEvent.BUTTON3;

        // preset: leave from comparision mode if it was in compraision status
        ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).setStatusInvisiable();
        /*
         * Catch all Left-Click Mouse Events.  If we are creating a relatinoship this
         * will signal the end of relationship creation.  The Currently active relationship
         * chain will be stopped and this method will return(to avoid activating other
         * mouse events).
         */
        if( WorkSet.makingRelationships && leftClick)
        {
            if(stopRelationshiping())
                return;
        }

        // ##1## right key to popup Dialog popmenu for select text to build a new annotation
        // ##2## caught similar annotations in all documents
        if( textPaneforClinicalNotes.getSelectedText() != null ) {

            // if the indicator is "ON"(false), check and correct span border
            // by space or symbols, o.w. use exact span user just selected
            operation_checkBorder_whileNeeded(textPaneforClinicalNotes);

            if(popmenu == null || !popmenu.isGood()) {
                /*ResultEditor.AnnotationBuilder.Popmenu*/
                popmenu = new ResultEditor.AnnotationBuilder.Popmenu( textPaneforClinicalNotes, this, evt);
            }

            // do not want to build a annotation by method of
            // "ONE-CLICK-TO-BUILD-ANNOTATION"
            if( env.Parameters.currentMarkables_to_createAnnotation_by1Click == null )
                popmenu.pop(evt.getX(), evt.getY(), this.getX(), this.getY(), this.getWidth(), this.getHeight());
            else
            // "ONE-CLICK-TO-BUILD-ANNOTATION", no popmenu will be pop out in following process
            {
                if( popmenu != null )
                {
                    popmenu.setVisible(false);
                    popmenu = new ResultEditor.AnnotationBuilder.Popmenu(textPaneforClinicalNotes, this, evt);
                }else
                    popmenu = new ResultEditor.AnnotationBuilder.Popmenu(textPaneforClinicalNotes, this, evt);

                String thismarkablename = env.Parameters.currentMarkables_to_createAnnotation_by1Click;
                popmenu.oneClicktoCreateAnnotation( thismarkablename );
            }


            return;
        }
        // #============================================================#
        // ##3## build complex relationships between annotaions
        // This occurs when Relationship button is toggled and a right
        // click occurs. This allows users to add Annotations to a
        // relationship and create new relationships.
        // #============================================================#
        else if( WorkSet.makingRelationships && rightClick)
        {
            //Simply return if no annotation is currently selected
            if(WorkSet.currentAnnotation == null)
                return;

            addRelationship(position);

            return;
        }

        
           ResultEditor.Annotations.Depot.SelectedAnnotationSet.selectAnnotations_ByPosition(
                textsourceFilename, position, true
           );
        // ##2## left key to get a current position and show found annotations
        // in this position
        
        // Record for current workset: latest position in text panel
        ResultEditor.WorkSpace.WorkSet.latestClickPosition = position;
        

        // if no annotation caught
        if (( selectedAnnotaions == null )||(selectedAnnotaions.size()<1)){
            // disable all operation buttons
            // if these is no annotation catched by current cursor position
            WorkSet.currentAnnotation = null;
            disableAnnotationDisplay();
            disable_AnnotationEditButtons();
            return;
        }
        //If same annotation Clicked open Attribute Editor
        else if(selectedAnnotaions.contains(WorkSet.currentAnnotation))//&& evt.getClickCount()==2)
        {
            openAttributeEditor();
            return;
        }

        // if got result in this cursor position
        int amount = selectedAnnotaions.size();
        if ( amount > 0) {

            if( amount >1 )
                ((UserInterface.AnnotationCompare.ExpandButton)jPanel60).setStatusExpandable();

            // record mouse position
            ResultEditor.WorkSpace.WorkSet.latestValidClickPosition = position;

            // show found annotations in list
            showSelectedAnnotations_inList(0);

            enable_AnnotationEditButtons();

            //Check for right click
            if(evt.getModifiers()== java.awt.event.InputEvent.BUTTON3_MASK){
                Annotation toPopFor = WorkSet.currentAnnotation;
                ResultEditor.PopUp.rightClickOnAnnotPopUp annotPopUp = new ResultEditor.PopUp.rightClickOnAnnotPopUp(
                this.textPaneforClinicalNotes, this);
                annotPopUp.pop(toPopFor,evt.getX(), evt.getY());
            }

        } else {
            // disable all operation buttons
            // if these is no annotation catched by current cursor position
            disableAnnotationDisplay();
            disable_AnnotationEditButtons();
        }

    }
    /**
     * called when mouse clicked on overlapping label
     * @param evt
     */
    private void overlappingMouseClicked(MouseEvent evt) {
        setToSpanConflict();
    }
    /**
     * Refresh Annotation information tab
     * @param evt - button pressed
     */
    private void refreshActionPerformed(java.awt.event.ActionEvent evt) {
        refreshInfo();
    }
    /**event: mouse clicked on class tree view. Only can called by system listener.*/
    private void userMouseClicked_onClassTreeView(java.awt.event.MouseEvent evt){
        ResultEditor.AnnotationClasses.Mouse.ClickedListener clicklistener =
                new ResultEditor.AnnotationClasses.Mouse.ClickedListener( evt, jTree_class, this, textPaneforClinicalNotes );
        clicklistener.process();
    }

    
    public void display_refreshNAV_WorkSpace()
    {
        
        // show path of current workspace
        String workspacepath = env.Parameters.WorkSpace.WorkSpace_AbsolutelyPath;
        if (workspacepath == null)
        {
            //jLabel_currentworkspace_abspath.setText("<html><b>NO SETTING</b> </html>");
            WorkSpace.Switcher.RecentWorkSpace rw =
                    new WorkSpace.Switcher.RecentWorkSpace(jComboBox_currentworkspace_abspath);
            rw.emptyCombobox();
                           
        }
        else
        {
            WorkSpace.Switcher.RecentWorkSpace rw =
                    new WorkSpace.Switcher.RecentWorkSpace(jComboBox_currentworkspace_abspath);
            rw.addWorkspace(new File(workspacepath));
            
            if(RecentWorkSpace.getItemCount()!=jComboBox_currentworkspace_abspath.getItemCount())
                rw.updateWorkspaces_inCombobox();

            //jComboBox1.removeAllItems();
        }

            //jComboBox_currentworkspace_abspath.setSelectedItem("<html><b>NO SETTING</b> </html>");
            

        // list all projects under current workspace
        NavigatorContainer.ListProjects lp = new  NavigatorContainer.
                ListProjects( this, jList_NAV_projects, workspacepath );
        lp.showProjectsInList();

        this.jList_NAV_projects.updateUI();

    }
    //</editor-fold>

    /**The method is gonna to update your GUI component and some values by
     * the parameters that you got from project.cfg of current project.
     */
    public void updateGUI_byProjectParameters()
    {
        setFlag_of_OracleSimilarPhraseSeeker(env.Parameters.enabledOracleSimilarPhraseSeeker);
        setFlag_of_GraphPath_Display(env.Parameters.enabled_GraphPath_Display );
        setFlag_of_DifferenceMatching_Display(env.Parameters.enabled_Diff_Display );
        
    }

    /**Enable or disable functions by showing or hiding buttons on the tools bar.*/
    private void enableFunctionsByMask(){
        if((env.Parameters.Sysini.functions==null)||(env.Parameters.Sysini.functions.length!=6))
        {
            env.Parameters.Sysini.functions = new char[6];
            for(int i=0;i<6; i++){
                env.Parameters.Sysini.functions[i]=0;
            }
            env.Parameters.Sysini.functions[1]=1;
            env.Parameters.Sysini.functions[5]=1;            
        }
        
        if(env.Parameters.Sysini.functions[0]=='1')
            jToggleButton_ResultEditor.setVisible(true);
        else
            jToggleButton_ResultEditor.setVisible(false);

        if(env.Parameters.Sysini.functions[1]=='1')
            jToggleButton_CreateAnnotaion.setVisible(true);
        else
            jToggleButton_CreateAnnotaion.setVisible(false);

        if(env.Parameters.Sysini.functions[2]=='1')
            jToggleButton_PinExtractor.setVisible(true);
        else
            jToggleButton_PinExtractor.setVisible(false);

        if(env.Parameters.Sysini.functions[3]=='1')
            jToggleButton_DictionaryManager.setVisible(true);
        else
            jToggleButton_DictionaryManager.setVisible(false);

        if(env.Parameters.Sysini.functions[4]=='1')
            jToggleButton_Converter.setVisible(true);
        else
            jToggleButton_Converter.setVisible(false);

        if(env.Parameters.Sysini.functions[5]=='1')
            jToggleButton_DictionarySetting.setVisible(true);
        else
            jToggleButton_DictionarySetting.setVisible(false);

        // hide the button of pre-pairing functions
        this.jButton_save1.setVisible(false);
    }
}



